diff --git a/packages/compiler-sfc/src/templateCompilerModules/utils.ts b/packages/compiler-sfc/src/templateCompilerModules/utils.ts
index fa02fd2bdc..3e635b0020 100644
--- a/packages/compiler-sfc/src/templateCompilerModules/utils.ts
+++ b/packages/compiler-sfc/src/templateCompilerModules/utils.ts
@@ -31,7 +31,6 @@ export function urlToRequire(
uriParts.path + (uriParts.hash || '')
)}"`
}
- return returnValue
}
if (
diff --git a/packages/compiler-sfc/test/compileTemplate.spec.ts b/packages/compiler-sfc/test/compileTemplate.spec.ts
index bba5d032dd..a405d644a4 100644
--- a/packages/compiler-sfc/test/compileTemplate.spec.ts
+++ b/packages/compiler-sfc/test/compileTemplate.spec.ts
@@ -207,6 +207,7 @@ test('transform assetUrls and srcset with base option', () => {
+
`
const result = compileTemplate({
@@ -218,13 +219,16 @@ test('transform assetUrls and srcset with base option', () => {
expect(result.errors.length).toBe(0)
- const vnode = mockRender(result.code)
+ const vnode = mockRender(result.code, {
+ '@/fixtures/logo.png': 'aliased'
+ })
expect(vnode.children[0].data.attrs.src).toBe('/base/logo.png')
expect(vnode.children[2].data.attrs.src).toBe('/base/fixtures/logo.png')
expect(vnode.children[4].data.attrs.src).toBe('/base/fixtures/logo.png')
expect(vnode.children[6].data.attrs.srcset).toBe(
'/base/logo.png 2x, /base/logo.png 3x'
)
+ expect(vnode.children[8].data.attrs.src).toBe('aliased')
})
test('transform with includeAbsolute', () => {