-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
127 lines (123 loc) · 3.5 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* eslint-disable max-len */
// 去console插件
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
// gzip压缩插件
const CompressionWebpackPlugin = require('compression-webpack-plugin');
// 拷贝文件插件
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const path = require('path');
const cesiumSource = './node_modules/cesium/Source';
const cesiumWorkers = '../Build/Cesium/Workers';
const appInfo = require('./src/appinfo');
module.exports = {
baseUrl: '',
// 生产环境下 sourceMap
productionSourceMap: false,
// iez3d配置
configureWebpack: {
output: {
sourcePrefix: ' '
},
amd: {
toUrlUndefined: true
},
resolve: {
// extensions: ['', '.js', '.vue'],
alias: {
vue$: 'vue/dist/vue.esm.js',
'@': path.resolve('src'),
cesium: path.resolve(__dirname, cesiumSource)
// layer: path.resolve(__dirname, `${path.resolve('src')}/libs/js/layer/layer.js`),
// 'layer.css': path.resolve(__dirname, `${path.resolve('src')}/libs/js/layer/theme/default/layer.css`),
}
},
plugins: [
// new UglifyJsPlugin({
// uglifyOptions: {
// compress: {
// warnings: false,
// drop_debugger: true,
// drop_console: true,
// },
// },
// sourceMap: false,
// parallel: true,
// }),
// new CompressionWebpackPlugin({
// asset: '[path].gz[query]',
// algorithm: 'gzip',
// test: new RegExp(
// '\\.(' +
// ['js', 'css'].join('|') +
// ')$',
// ),
// threshold: 10240,
// minRatio: 0.8,
// }),
new CopyWebpackPlugin([{ from: path.join(cesiumSource, cesiumWorkers), to: 'static/Workers' }]),
new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'Assets'), to: 'static/Assets' }]),
new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'Widgets'), to: 'static/Widgets' }]),
new CopyWebpackPlugin([{ from: path.join(cesiumSource, 'ThirdParty/Workers'), to: 'static/ThirdParty/Workers' }]),
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify('/static')
})
],
optimization: {
splitChunks: {
cacheGroups: {
commons: {
name: 'Cesium',
test: /[\\/]node_modules[\\/]cesium/,
chunks: 'all'
}
}
}
},
module: {
// noParse: [/videojs-contrib-hls/],
rules: [
// {
// test: require.resolve('jquery'),
// use: [{
// loader: 'expose-loader',
// options: 'jQuery'
// }, {
// loader: 'expose-loader',
// options: '$'
// }]
// }
],
// unknownContextCritical: /^.\/.*$/,
unknownContextCritical: false
}
},
css: {
// 启用 CSS modules
modules: false,
// 是否使用css分离插件
extract: true,
// 开启 CSS source maps?
sourceMap: false,
// css预设器配置项
loaderOptions: {}
},
pluginOptions: {
electronBuilder: {
builderOptions: {
productName: appInfo.appName,
buildDependenciesFromSource: false,
nsis: {
oneClick: false,
allowToChangeInstallationDirectory: true
},
win: {
icon: 'build/appIcon.ico'
},
files: [
'!node_modules'
]
}
}
}
};