Commit 4eb65072 authored by 赵啸非's avatar 赵啸非

修改前端

parent 2aa748aa
...@@ -34,6 +34,8 @@ const assetsCDN = { ...@@ -34,6 +34,8 @@ const assetsCDN = {
], ],
}; };
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = { module.exports = {
devServer: { devServer: {
...@@ -57,69 +59,7 @@ module.exports = { ...@@ -57,69 +59,7 @@ module.exports = {
patterns: [path.resolve(__dirname, "./src/theme/theme.less")], patterns: [path.resolve(__dirname, "./src/theme/theme.less")],
}, },
}, },
configureWebpack: (config) => {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
{
analyzerMode: 'static'
}
])
plugins: process.env.NODE_ENV === "production" ? [] : [...devPlugins];
config.entry.app = ["babel-polyfill", "whatwg-fetch", "./src/main.js"];
config.performance = {
hints: false,
};
config.plugins.push(
new ThemeColorReplacer({
fileName: "css/theme-colors-[contenthash:8].css",
matchColors: getThemeColors(),
injectCss: true,
resolveCss,
})
);
config.plugins.push(
// 控制富文本图片大小
new webpack.ProvidePlugin({
"window.Quill": "quill/dist/quill.js",
Quill: "quill/dist/quill.js",
})
);
// Ignore all locale files of moment.js
// config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
// 生产环境下将资源压缩成gzip格式
if (isProd) {
// add `CompressionWebpack` plugin to webpack plugins
config.plugins.push(
new CompressionWebpackPlugin({
algorithm: "gzip",
test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"),
threshold: 10240,
minRatio: 0.8,
})
);
}
// if prod, add externals
if (isProd) {
config.externals = assetsCDN.externals;
}
},
chainWebpack: (config) => {
// 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
if (isProd) {
config.plugin("optimize-css").tap((args) => {
args[0].cssnanoOptions.preset[1].colormin = false;
return args;
});
}
// 生产环境下使用CDN
// if (isProd) {
// config.plugin('html')
// .tap(args => {
// args[0].cdn = assetsCDN
// return args
// })
// }
},
css: { css: {
loaderOptions: { loaderOptions: {
less: { less: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment