提交 ce69fd19 编写于 作者: fxy060608's avatar fxy060608

fix(vue2): 兼容webpack5下app端部分静态资源引用不到

上级 7cc85ad8
......@@ -7,9 +7,10 @@ module.exports = function (url, options) {
} // eslint-disable-next-line no-underscore-dangle, no-param-reassign
url = url && url.__esModule ? url.default : url
let isAbsoluteFile = false
if (typeof url !== 'string') {
if (url.protocol && url.protocol === 'file:' && url.pathname) {
isAbsoluteFile = true
url = url.pathname
} else {
return url
......@@ -30,8 +31,11 @@ module.exports = function (url, options) {
if (/["'() \t\n]/.test(url) || options.needQuotes) {
return '"'.concat(url.replace(/"/g, '\\"').replace(/\n/g, '\\n'), '"')
}
if (isAbsoluteFile) {
return url
}
if (url.indexOf('/') === 0) {
return url.substr(1)
}
return url
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册