fix(compiler-sfc): <script> after <script setup> the script content not end with \\n

This commit is contained in:
liulinboyi
2022-04-24 20:39:18 +08:00
committed by Evan You
parent 242914d938
commit 3b7b107120
3 changed files with 166 additions and 136 deletions

View File

@@ -168,6 +168,16 @@ defineExpose({ foo: 123 })
expect(content).toMatch(/\bexpose\(\{ foo: 123 \}\)/)
})
test('<script> after <script setup> the script content not end with `\\n`',() => {
const { content } = compile(`
<script setup>
import { x } from './x'
</script>
<script>const n = 1</script>
`)
assertCode(content)
})
describe('<script> and <script setup> co-usage', () => {
test('script first', () => {
const { content } = compile(`