mirror of https://github.com/vuejs/vue.git
feat(compiler-sfc): support includeAbsolute in transformAssetUrl
This commit is contained in:
parent
96cd1d03fd
commit
8f5817a7c9
|
|
@ -13,6 +13,10 @@ export interface TransformAssetUrlsOptions {
|
||||||
* imports, they will be directly rewritten to absolute urls.
|
* imports, they will be directly rewritten to absolute urls.
|
||||||
*/
|
*/
|
||||||
base?: string
|
base?: string
|
||||||
|
/**
|
||||||
|
* If true, also processes absolute urls.
|
||||||
|
*/
|
||||||
|
includeAbsolute?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultOptions: AssetURLOptions = {
|
const defaultOptions: AssetURLOptions = {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,12 @@ export function urlToRequire(
|
||||||
return returnValue
|
return returnValue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstChar === '.' || firstChar === '~' || firstChar === '@') {
|
if (
|
||||||
|
transformAssetUrlsOption.includeAbsolute ||
|
||||||
|
firstChar === '.' ||
|
||||||
|
firstChar === '~' ||
|
||||||
|
firstChar === '@'
|
||||||
|
) {
|
||||||
if (!uriParts.hash) {
|
if (!uriParts.hash) {
|
||||||
return `require("${url}")`
|
return `require("${url}")`
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue