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

fix(v3): asset url

上级 12536093
...@@ -68,10 +68,15 @@ function rewrite (attr, name, options) { ...@@ -68,10 +68,15 @@ function rewrite (attr, name, options) {
.replace('"@/', '"/') .replace('"@/', '"/')
.replace('"~@/', '"/') .replace('"~@/', '"/')
} }
// h5 // v3,h5
if (options.h5) { const needRequire = options.service || options.view || options.h5
if (needRequire) {
attr.value = urlToRequire(attr.value.slice(1, -1)) attr.value = urlToRequire(attr.value.slice(1, -1))
if (attr.value.startsWith('require("') && options.publicPath === './') { // require if (
options.h5 &&
options.publicPath === './' &&
attr.value.startsWith('require("')
) { // require
// h5 且 publicPath 为 ./ (仅生产模式可能为./) // h5 且 publicPath 为 ./ (仅生产模式可能为./)
attr.value = `(${attr.value}).substr(1)` attr.value = `(${attr.value}).substr(1)`
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册