fix(compiler-sfc): fix 'export default' rewrite with extra whitespaces (#4375)
This commit is contained in:
@@ -140,6 +140,43 @@ defineExpose({ foo: 123 })
|
||||
})
|
||||
|
||||
describe('<script> and <script setup> co-usage', () => {
|
||||
describe('spaces in ExportDefaultDeclaration node', () => {
|
||||
// #4371
|
||||
test('with many spaces and newline', () => {
|
||||
// #4371
|
||||
const { content } = compile(`
|
||||
<script>
|
||||
export const n = 1
|
||||
export default
|
||||
{
|
||||
some:'option'
|
||||
}
|
||||
</script>
|
||||
<script setup>
|
||||
import { x } from './x'
|
||||
x()
|
||||
</script>
|
||||
`)
|
||||
assertCode(content)
|
||||
})
|
||||
|
||||
test('with minimal spaces', () => {
|
||||
const { content } = compile(`
|
||||
<script>
|
||||
export const n = 1
|
||||
export default{
|
||||
some:'option'
|
||||
}
|
||||
</script>
|
||||
<script setup>
|
||||
import { x } from './x'
|
||||
x()
|
||||
</script>
|
||||
`)
|
||||
assertCode(content)
|
||||
})
|
||||
})
|
||||
|
||||
test('script first', () => {
|
||||
const { content } = compile(`
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user