Subscribe on changes!

sfc script setup bad transformation caused by extra spaces ( default export + script setup)

avatar
Aug 17th 2021

Version

3.2.4

Reproduction link

sfc playground

Steps to reproduce

see sfc link generated js code.

this issue depends on having a default export in a regular <script> tag and <script setup>

What is expected?

no syntax error

What is actually happening?

generated code has syntax error.

input:

<script>
 // extra spaces between export and default result in parts of 'default' showing in generated code
// depend on the number of extra spaces.
  export      default  {
     // see compiled code for fault
  }
</script>

generated

  const __default__ =fault  {
     // see compiled code for fault
  }