Subscribe on changes!

compilerOptions whitespace: 'preserve' causes compiler error with named slots and default slot

avatar
May 13th 2021

Version

3.1.0-beta.3

Reproduction link

https://codesandbox.io/s/tender-night-xbivj?file=/src/components/HelloWorld.vue

Steps to reproduce

(Note: Minimal reproduction is missing turning on compilerOptions: { whitespace: 'preserve' }. I've spent too much time trying to get it to be set in codesandbox.io. Any help appreciated)

  1. Turn on compilerOptions: { whitespace: 'preserve' }.
  2. Use a component that takes a named slot and a default slot formatted with a line break between the template tags.
    <slotted-component>
      <template #header> Test Header </template>
      <template #default> Test Default </template>
    </slotted-component>

What is expected?

Component to compile correctly.

What is actually happening?

VueCompilerError: Extraneous children found when component already has explicitly named default slot. These children will be ignored.


If you remove the line break between the template tags, the compiler is happy.