Skip to content

Commit

Permalink
fix: 针对百度小程序进行css本地资源路径进行处理
Browse files Browse the repository at this point in the history
  • Loading branch information
18148764734 committed Apr 17, 2024
1 parent 4723843 commit d4405f5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/vue-cli-plugin-uni/lib/chain-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
})
}
} else {
langRule.oneOf(type)
.use('extract-css-loader')
.tap(options => {
// 参考 https://github.com/vuejs/vue-cli/commit/b41ed76c5ce54c618587f24b9d14c35cf31a96d4
// 修复 部分平台 css 内的资源路径不正确,如uni-icons在百度小程序上引用的字体文件路径
options.publicPath = '/'
return options
})
if (process.env.UNI_PLATFORM === "mp-baidu") {
langRule.oneOf(type)
.use('extract-css-loader')
.tap(options => {
// 参考 https://github.com/vuejs/vue-cli/commit/b41ed76c5ce54c618587f24b9d14c35cf31a96d4
// 修复 部分平台 css 内的资源路径不正确,如uni-icons在百度小程序上引用的字体文件路径
if (options) options.publicPath = '/'
return options
})
}
}
langRule.oneOf(type)
.use('uniapp-preprocss')
Expand Down

0 comments on commit d4405f5

Please sign in to comment.