-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
49 lines (46 loc) · 1.21 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
const path = require('path');
const webpack = require('webpack');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
function addStyleResource(rule) {
rule
.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, 'src/styles/theme/variables.less'), // 需要全局导入的less
path.resolve(__dirname, 'src/styles/mixins/index.less'),
],
});
}
module.exports = {
configureWebpack: {
optimization: {
splitChunks: {
minSize: 1000000,
maxSize: 1500000,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 3,
automaticNameDelimiter: '-',
},
},
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// Improve build speed
new HardSourceWebpackPlugin(),
],
},
chainWebpack: (config) => {
const types = ['vue-modules', 'vue', 'normal-modules', 'normal'];
types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)));
},
css: {
loaderOptions: {
less: {
javascriptEnabled: true,
},
},
},
lintOnSave: true,
};