diff --git a/vue.config.js b/vue.config.js index 23fba30..672a158 100644 --- a/vue.config.js +++ b/vue.config.js @@ -27,21 +27,6 @@ module.exports = { config .when(process.env.NODE_ENV !== 'development', config => { - - // 默认css文件中的url()不能根据__webpack_public_path__来动态改变根路径,将其编译成 base64 内嵌到css文件 - config.module - .rule("fonts") - .test(/.(ttf|otf|eot|woff|woff2)$/) - .use("url-loader") - .loader("url-loader") - .tap((options) => { - options = { - limit: 10000, - name: "/static/fonts/[name].[ext]", - }; - return options; - }) - config.optimization.splitChunks({ chunks: 'all', cacheGroups: { @@ -65,6 +50,16 @@ module.exports = { } } }) + + // fixme: 默认css文件中的url()不能根据__webpack_public_path__来动态改变根路径 + config.module + .rule('fonts') + .test(/.(ttf|otf|eot|woff|woff2)$/) + .use("url-loader") + .loader("url-loader") + .tap((options) => ({ + name: "/static/fonts/[name].[ext]", + })) } ) },