fix(compiler-sfc): transformAssetUrl should ignore inline data url (#1431)

This commit is contained in:
underfin
2020-06-24 09:46:18 +08:00
committed by GitHub
parent 37a5952c09
commit 90c285c5c8
8 changed files with 61 additions and 4 deletions

View File

@@ -7,7 +7,12 @@ import {
SourceLocation,
TransformContext
} from '@vue/compiler-core'
import { isRelativeUrl, parseUrl, isExternalUrl } from './templateUtils'
import {
isRelativeUrl,
parseUrl,
isExternalUrl,
isDataUrl
} from './templateUtils'
import { isArray } from '@vue/shared'
export interface AssetURLTagConfig {
@@ -99,6 +104,7 @@ export const transformAssetUrl: NodeTransform = (
!assetAttrs.includes(attr.name) ||
!attr.value ||
isExternalUrl(attr.value.content) ||
isDataUrl(attr.value.content) ||
attr.value.content[0] === '#' ||
(!options.includeAbsolute && !isRelativeUrl(attr.value.content))
) {