提交 85250e38 编写于 作者: Q qiang

fix: webpack5 static file path

上级 e653e856
......@@ -33,6 +33,22 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
}
})
}
if (newOptions.fallback && newOptions.fallback.options) {
const generator = {}
const oldOptions = newOptions.fallback.options
const keys = ['publicPath', 'outputPath']
keys.forEach(key => {
generator[key] = pathData => {
const outputPath = oldOptions.outputPath(null, pathData.module.request)
const basename = path.basename(outputPath)
return outputPath.substring(0, outputPath.length - basename.length)
}
})
generator.filename = pathData => {
return path.basename(pathData.module.request)
}
webpackConfig.module.rule(staticType).set('generator', generator)
}
} else {
webpackConfig.module
.rule(staticType)
......@@ -68,6 +84,18 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
))
.before('css-loader')
}
if (webpack.version[0] > 4) {
langRule.oneOf(type)
.use('css-loader')
.tap(options => {
options.url = {
filter: function (url) {
return url[0] !== '/'
}
}
return options
})
}
langRule.oneOf(type)
.use('uniapp-preprocss')
.loader(resolve('packages/webpack-preprocess-loader'))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册