fix(compiler-sfc): only transform relative asset URLs (#628)

This commit is contained in:
Sören Schwert
2020-01-20 15:57:17 +01:00
committed by Evan You
parent 787ac5f74e
commit c71ca354b9
8 changed files with 67 additions and 30 deletions

View File

@@ -7,7 +7,7 @@ import {
SourceLocation,
TransformContext
} from '@vue/compiler-core'
import { parseUrl } from './templateUtils'
import { isRelativeUrl, parseUrl } from './templateUtils'
export interface AssetURLOptions {
[name: string]: string[]
@@ -46,6 +46,7 @@ export const transformAssetUrl: NodeTransform = (
if (attr.type !== NodeTypes.ATTRIBUTE) return
if (attr.name !== item) return
if (!attr.value) return
if (!isRelativeUrl(attr.value.content)) return
const url = parseUrl(attr.value.content)
const exp = getImportsExpressionExp(
url.path,