|
|
@ -27,21 +27,6 @@ module.exports = { |
|
|
|
config |
|
|
|
config |
|
|
|
.when(process.env.NODE_ENV !== 'development', |
|
|
|
.when(process.env.NODE_ENV !== 'development', |
|
|
|
config => { |
|
|
|
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({ |
|
|
|
config.optimization.splitChunks({ |
|
|
|
chunks: 'all', |
|
|
|
chunks: 'all', |
|
|
|
cacheGroups: { |
|
|
|
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]", |
|
|
|
|
|
|
|
})) |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
}, |
|
|
|
}, |
|
|
|