fix(compiler-sfc): fix skipped srcset transform when using base option

Based on implementation from #4835 due to conflicts

fix #4819
close #4834, close #4835
This commit is contained in:
Evan You
2022-05-11 16:55:58 +08:00
parent 57bb37bd64
commit 41d255ba5d
3 changed files with 48 additions and 13 deletions

View File

@@ -86,4 +86,16 @@ describe('compiler sfc: transform srcset', () => {
expect(code).toMatch(`_createStaticVNode`)
expect(code).toMatchSnapshot()
})
test('srcset w/ explicit base option', () => {
const code = compileWithSrcset(
`
<img srcset="@/logo.png, @/logo.png 2x"/>
<img srcset="@/logo.png 1x, ./logo.png 2x"/>
`,
{ base: '/foo/' },
{ hoistStatic: true }
).code
expect(code).toMatchSnapshot()
})
})