-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
64 lines (63 loc) · 1.74 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
const path = require('path')
const webpack = require('webpack')
const CompressionPlugin = require("compression-webpack-plugin")
function resolve(dir) {
return path.join(__dirname, dir);
}
module.exports = {
publicPath: '/',
outputDir: resolve('../document-apiserver/public'), // 构建目录
assetsDir: '', //静态资源目录
devServer: {
host: '0.0.0.0',
// proxy: 'http://api.we7888.cn/',
// proxy: 'http://192.168.168.31:99/',
proxy: 'http://wiki.we7888.cn/',
// proxy: {
// '/api': {
// target: 'http://192.168.168.23:99/',
// // secure: false,
// changeOrigin: true,
// // pathRewrite: {
// // '^/api': '',
// // },
// }
// }
},
chainWebpack: config => {
config.resolve.alias.set('@', resolve('src'))
config.plugins.delete('prefetch') // 移除prefetch
},
productionSourceMap: false,
runtimeCompiler: false,
transpileDependencies: [],
css: {
sourceMap: false
},
configureWebpack: config => {
/*
* npm install terser-webpack-plugin --save
* 去除生产环境console.log*/
if(process.env.NODE_ENV === 'production'){
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
}
return {
performance: {
hints: false
},
plugins: [
new CompressionPlugin({
test: /\.js$|\.html$|\.css/,
threshold: 10240,
deleteOriginalAssets: false
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"windows.jQuery": "jquery",
}),
// new webpack.HotModuleReplacementPlugin() // hot: true 开启了hot模式,无需手动加载HotModuleReplacementPlugin
],
}
},
}