|
@@ -1,31 +1,34 @@
|
|
-const CompressionPlugin = require('compression-webpack-plugin');
|
|
|
|
-const webpack = require('webpack');
|
|
|
|
-const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
|
|
|
|
+const CompressionPlugin = require("compression-webpack-plugin");
|
|
|
|
+const webpack = require("webpack");
|
|
|
|
+const BundleAnalyzerPlugin =
|
|
|
|
+ require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
|
|
module.exports = {
|
|
module.exports = {
|
|
- publicPath: process.env.NODE_ENV === 'production' ? '' : '/',
|
|
|
|
|
|
+ publicPath: process.env.NODE_ENV === "production" ? "" : "/",
|
|
productionSourceMap: false,
|
|
productionSourceMap: false,
|
|
lintOnSave: false,
|
|
lintOnSave: false,
|
|
|
|
|
|
- chainWebpack: config => {
|
|
|
|
- if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
|
+ chainWebpack: (config) => {
|
|
|
|
+ if (process.env.NODE_ENV === "production") {
|
|
if (process.env.npm_config_report) {
|
|
if (process.env.npm_config_report) {
|
|
config
|
|
config
|
|
- .plugin('webpack-bundle-analyzer')
|
|
|
|
- .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
|
|
|
|
|
|
+ .plugin("webpack-bundle-analyzer")
|
|
|
|
+ .use(
|
|
|
|
+ require("webpack-bundle-analyzer").BundleAnalyzerPlugin
|
|
|
|
+ );
|
|
}
|
|
}
|
|
- config.plugins.delete('prefetch');
|
|
|
|
|
|
+ config.plugins.delete("prefetch");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- configureWebpack: config => {
|
|
|
|
- if (process.env.NODE_ENV === 'production') {
|
|
|
|
|
|
+ configureWebpack: (config) => {
|
|
|
|
+ if (process.env.NODE_ENV === "production") {
|
|
config.optimization = {
|
|
config.optimization = {
|
|
splitChunks: {
|
|
splitChunks: {
|
|
- chunks: "all", //async异步代码分割 initial同步代码分割 all同步异步分割都开启
|
|
|
|
- minSize: 10000, //字节 引入的文件大于30kb才进行分割
|
|
|
|
|
|
+ chunks: "all", //async异步代码分割 initial同步代码分割 all同步异步分割都开启
|
|
|
|
+ minSize: 10000, //字节 引入的文件大于30kb才进行分割
|
|
// minChunks: 2, //模块至少使用次数
|
|
// minChunks: 2, //模块至少使用次数
|
|
// maxAsyncRequests: 25, //同时加载的模块数量最多是5个,只分割出同时引入的前5个文件
|
|
// maxAsyncRequests: 25, //同时加载的模块数量最多是5个,只分割出同时引入的前5个文件
|
|
// maxInitialRequests: 30, //首页加载的时候引入的文件最多3个
|
|
// maxInitialRequests: 30, //首页加载的时候引入的文件最多3个
|
|
- automaticNameDelimiter: '-', //缓存组和生成文件名称之间的连接符
|
|
|
|
|
|
+ automaticNameDelimiter: "-", //缓存组和生成文件名称之间的连接符
|
|
// name: true, //缓存组里面的filename生效,覆盖默认命名
|
|
// name: true, //缓存组里面的filename生效,覆盖默认命名
|
|
cacheGroups: {
|
|
cacheGroups: {
|
|
// vue: {
|
|
// vue: {
|
|
@@ -53,9 +56,9 @@ module.exports = {
|
|
// test: /[\\\/]node_modules[\\\/]/,
|
|
// test: /[\\\/]node_modules[\\\/]/,
|
|
// priority: -20
|
|
// priority: -20
|
|
// },
|
|
// },
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ };
|
|
// return {
|
|
// return {
|
|
// plugins: [
|
|
// plugins: [
|
|
// new CompressionPlugin({
|
|
// new CompressionPlugin({
|
|
@@ -83,25 +86,43 @@ module.exports = {
|
|
// // new BundleAnalyzerPlugin()
|
|
// // new BundleAnalyzerPlugin()
|
|
// ]
|
|
// ]
|
|
}
|
|
}
|
|
-
|
|
|
|
},
|
|
},
|
|
parallel: true,
|
|
parallel: true,
|
|
|
|
|
|
devServer: {
|
|
devServer: {
|
|
proxy: {
|
|
proxy: {
|
|
- '/': {
|
|
|
|
|
|
+ // 开发环境变化可注释 ⬇️⬇️
|
|
|
|
+ "/market/CMK": {
|
|
|
|
+ target: "http://192.168.1.9:9114",
|
|
|
|
+ ws: false,
|
|
|
|
+ changeOrigin: true,
|
|
|
|
+ pathRewrite: {
|
|
|
|
+ "^/market": "",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ "/mkWangge": {
|
|
|
|
+ target: "http://192.168.1.19:9114",
|
|
|
|
+ ws: false,
|
|
|
|
+ changeOrigin: true,
|
|
|
|
+ pathRewrite: {
|
|
|
|
+ "^/market": "",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ // 开发环境变化可注释 ⬆️⬆️
|
|
|
|
+ "/": {
|
|
// target: 'http://192.168.2.145:9600/spfm',
|
|
// target: 'http://192.168.2.145:9600/spfm',
|
|
// target: 'http://192.168.2.149:9600',
|
|
// target: 'http://192.168.2.149:9600',
|
|
// target: 'http://10.64.42.70:8088/',
|
|
// target: 'http://10.64.42.70:8088/',
|
|
// target: 'http://114.215.71.182:29600',
|
|
// target: 'http://114.215.71.182:29600',
|
|
- target: 'http://192.168.1.9:9600/spfm',
|
|
|
|
|
|
+ // target: 'http://192.168.1.9:9600/spfm',
|
|
// target: 'http://127.0.0.1:9600/',
|
|
// target: 'http://127.0.0.1:9600/',
|
|
// target: 'http://192.168.0.156:9600/',
|
|
// target: 'http://192.168.0.156:9600/',
|
|
// target: 'http://192.168.2.170:9600/',
|
|
// target: 'http://192.168.2.170:9600/',
|
|
// target: 'http://192.168.2.169:9600/',
|
|
// target: 'http://192.168.2.169:9600/',
|
|
- changeOrigin: true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ target: "http://192.168.1.228:9600/spfm",
|
|
|
|
+ changeOrigin: true,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- transpileDependencies: ['color-string'] // 此段为增加配置选项
|
|
|
|
-}
|
|
|
|
|
|
+ transpileDependencies: ["color-string"], // 此段为增加配置选项
|
|
|
|
+};
|