forked from szsyzx/nvjdcweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
85 lines (80 loc) · 2.37 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
const CompressionWebpackPlugin = require('compression-webpack-plugin');
var webpack = require('webpack')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
module.exports = {
devServer: {
overlay: {
warnings: false,
errors: false
},
},
lintOnSave: false,
chainWebpack: config => {
// 移除 prefetch 插件
config.plugins.delete('prefetch')
config.plugins.delete('preload')
},
productionSourceMap: process.env.NODE_ENV === 'production' ? false : true,
configureWebpack: {
devtool: "cheap-module-source-map",
plugins: [
new webpack.ProvidePlugin({
$: 'jquery', // 创建 '$'、'jQuery'、'window.jQuery' 三个变量指向依赖jquery
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new CompressionWebpackPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: /\.(js|css)(\?.*)?$/i,
threshold: 1024, // 只有大小大于该值的资源会被处理 10240
deleteOriginalAssets: false // 删除原文件true=删
}),
AutoImport({
resolvers: [ElementPlusResolver()]
}),
Components({
resolvers: [ElementPlusResolver()]
}),
],
}
}
// module.exports = {
// //webpack配置
// productionSourceMap: process.env.NODE_ENV === 'production' ? false : true,
// configureWebpack: {
// 'externals': {
// vue: 'Vue',
// 'vue-router': 'VueRouter',
// 'element-plus': 'ElementPlus'
// },
// //关闭 webpack 的性能提示
// performance: {
// hints:false
// },
// plugins: [
// new webpack.ProvidePlugin({
// $: 'jquery', // 创建 '$'、'jQuery'、'window.jQuery' 三个变量指向依赖jquery
// jQuery: 'jquery',
// 'window.jQuery': 'jquery'
// }),
// new webpack.optimize.LimitChunkCountPlugin({
// maxChunks: 5,
// minChunkSize: 100
// })
// ],
// performance: {
// hints:'warning',
// //入口起点的最大体积
// maxEntrypointSize: 800,
// //生成文件的最大体积
// maxAssetSize: 800,
// //只给出 js 文件的性能提示
// assetFilter: function(assetFilename) {
// return assetFilename.endsWith('.js');
// }
// }
// }
// }