fix(compiler-ssr): keep the order of imports expression for the fallback branch of SSR (#3448)

fix #3447
This commit is contained in:
HcySunYang
2021-03-25 23:10:25 +08:00
committed by GitHub
parent 776951315d
commit 49f4072c83
2 changed files with 17 additions and 0 deletions

View File

@@ -137,3 +137,19 @@ test('preprocessor errors', () => {
`The end of the string reached with no closing bracket ) found.`
)
})
// #3447
test('should generate the correct imports expression', () => {
const { code } = compile({
filename: 'example.vue',
source: `
<img src="./foo.svg"/>
<Comp>
<img src="./bar.svg"/>
</Comp>
`,
ssr: true
})
expect(code).toMatch(`_ssrRenderAttr(\"src\", _imports_1)`)
expect(code).toMatch(`_createVNode(\"img\", { src: _imports_1 })`)
})