|
@@ -1,11 +1,15 @@
|
|
|
const path = require("path");
|
|
|
+const TerserPlugin = require("terser-webpack-plugin");
|
|
|
+const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
|
+const WorkboxPlugin = require("workbox-webpack-plugin");
|
|
|
+const HappyPack = require("happypack");
|
|
|
+const webpack = require("webpack");
|
|
|
|
|
|
function resolve(dir) {
|
|
|
return path.join(__dirname, dir);
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
|
- // 解析SVG组件
|
|
|
chainWebpack(config) {
|
|
|
config.module.rule("svg").exclude.add(resolve("src/icons")).end();
|
|
|
config.module
|
|
@@ -19,8 +23,27 @@ module.exports = {
|
|
|
symbolId: "icon-[name]",
|
|
|
})
|
|
|
.end();
|
|
|
+
|
|
|
+ config.plugin("happypack").use(HappyPack, [
|
|
|
+ {
|
|
|
+ loaders: ["babel-loader"],
|
|
|
+ },
|
|
|
+ ]);
|
|
|
+
|
|
|
+ // config.plugin('dll').use(webpack.DllPlugin, [
|
|
|
+ // {
|
|
|
+ // name: '[name]_library',
|
|
|
+ // path: path.join(__dirname, 'dll', '[name]-manifest.json'),
|
|
|
+ // },
|
|
|
+ // ]);
|
|
|
+
|
|
|
+ config.plugin("workbox").use(WorkboxPlugin.GenerateSW, [
|
|
|
+ {
|
|
|
+ clientsClaim: true,
|
|
|
+ skipWaiting: true,
|
|
|
+ },
|
|
|
+ ]);
|
|
|
},
|
|
|
- //vue.config.js
|
|
|
css: {
|
|
|
loaderOptions: {
|
|
|
postcss: {
|
|
@@ -33,12 +56,12 @@ module.exports = {
|
|
|
devServer: {
|
|
|
proxy: {
|
|
|
"/api": {
|
|
|
- // target: "http://192.168.5.4:16200", //内网
|
|
|
+ // target: "http://192.168.5.4:16200", // 石月
|
|
|
target: "http://192.168.50.235:16200",
|
|
|
// target: "http://106.120.102.238:16600",//外网
|
|
|
changeOrigin: true,
|
|
|
pathRewrite: {
|
|
|
- "^/api": "", //需要rewrite重写的,
|
|
|
+ "^/api": "", // 需要rewrite重写的,
|
|
|
},
|
|
|
},
|
|
|
},
|
|
@@ -49,5 +72,13 @@ module.exports = {
|
|
|
"@": resolve("src"),
|
|
|
},
|
|
|
},
|
|
|
+ optimization: {
|
|
|
+ usedExports: true,
|
|
|
+ splitChunks: {
|
|
|
+ chunks: "all",
|
|
|
+ },
|
|
|
+ minimize: true,
|
|
|
+ minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
|
|
|
+ },
|
|
|
},
|
|
|
};
|