-
Notifications
You must be signed in to change notification settings - Fork 40
/
vue.config.js
108 lines (105 loc) · 3.92 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const path = require('path');
function resolve (dir) {
return path.join(__dirname, dir);
}
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
// const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
// const CompressionWebpackPlugin = require('compression-webpack-plugin');
// const ProgressBarPlugin = require('progress-bar-webpack-plugin');
// const productionGzipExtensions = ['js', 'css', 'html']
module.exports = {
publicPath: process.env.NODE_ENV === 'production'
? '/Mxgraph-EasyFlowEditor/'
: '/',
outputDir: 'dist',
lintOnSave: true,
configureWebpack: {
plugins: [
// new ProgressBarPlugin(),
// new BundleAnalyzerPlugin(),
// new CompressionWebpackPlugin({
// filename: '[path].gz[query]',
// algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$',),
// threshold: 10240,//仅处理大于此大小的资产。以字节为单位。
// minRatio: 0.8,
// }),
],
optimization: {
// splitChunks: {
// chunks: "all",
// cacheGroups: {
// common: {
// name: 'chunk-common',
// test: /[\\/]node_modules[\\/]/,
// priority: 10,
// minChunks: 1,
// chunks: 'all',
// },
// elementUI: {
// name: "chunk-element-ui", // 单独将 elementUI 拆包
// priority: 20, // 权重要大于 libs 和 app 不然会被打包进 libs 或者 app
// test: /[\\/]node_modules[\\/]element-ui[\\/]/,
// },
// mxgraph: {
// name: "chunk-mxgraph", // 单独将 elementUI 拆包
// priority: 20, // 权重要大于 libs 和 app 不然会被打包进 libs 或者 app
// test: /[\\/]node_modules[\\/]mxgraph[\\/]/,
// },
// component: {
// name: 'chunk-componentaa',
// test: /[\\/]src[\\/]/,
// priority: 50,
// minChunks: 1,
// chunks: 'all',
// },
// }
// },
// minimizer: [
// new UglifyJsPlugin(
// {
// uglifyOptions: {
// compress: {
// reduce_vars: true,// 把使用多次的静态值自动定义为变量
// drop_debugger: true,// 删除所有的debugger语句
// drop_console: true,// 删除所有的console语句
// },
// parallel: true, // 允许并发
// cache: true, // 开启缓存
// output: {
// beautify: false // 使输出的代码尽可能紧凑
// }
// },
// }
// ),
// new CssMinimizerPlugin({
// parallel: true,// 多并发执行
// minimizerOptions: {
// preset: [
// "default",
// {
// discardComments: { removeAll: true },//移除所有注释
// },
// ],
// },
// })],
},
},
chainWebpack: (config) => {
config.module
.rule('')
.test(/mxClient\.js$/)
.use('exports-loader')
.loader('exports-loader?mxClient,mxToolbar,mxConnectionHandler,mxEllipse,mxConnectionConstraint,mxWindow,' +
'mxObjectCodec,mxGraphModel,mxActor,mxPopupMenu,mxShape,mxEventObject,mxGraph,mxPopupMenuHandler,mxPrintPreview,' +
'mxEventSource,mxRectangle,mxVertexHandler,mxMouseEvent,mxGraphView,mxCodecRegistry,mxImage,mxGeometry,' +
'mxRubberband,mxConstraintHandler,mxKeyHandler,mxDragSource,mxGraphModel,mxEvent,mxUtils,mxEvent,mxCodec,mxCell,' +
'mxConstants,mxPoint,mxGraphHandler,mxCylinder,mxCellRenderer,mxEvent,mxUndoManager')
.end();
config.resolve.alias
.set('@', resolve('src'))
.set('@assets', resolve('src/assets'));
// 按这种格式.set('', resolve('')) 自己添加
},
};