Subscribe on changes!

two script blocks complier err

avatar
Apr 24th 2022

Version

3.2.33

Reproduction link

sfc.vuejs.org/

Steps to reproduce

open it

What is expected?

After complier. script dont affect script-setup

What is actually happening?

It is unexpected


And this test cant pass too .

test('between two blocks should have "\n"', () => {
      const { content } = compile(`
      <script setup>
      import foo from './foo'
      </script>
      <script>const bar = 1</script>
        `)
      expect(content).not.toMatch(`const bar = 1import foo from './foo'`)
  })
avatar
Apr 24th 2022

I don't really understand what this is about.

The SFC playground has the second script block commented out in an illegal way (you can't use JS style comments outside of a script block), it that the issue? That this comment is erroneously applied to the import?

The I don't see the relation to the test you also posted, what is with the issue the line break? How is this related to the SFC Playground?

When I remove the weird comments, everything works just fine ....

avatar
Apr 24th 2022

Sorry, I don't know the second script block commented out in an illegal way. And the test is seems like illegal too.