-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
44 lines (42 loc) · 1.34 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
// vue.config.js
const path = require('path');
const _src = 'src';
const DIRNAME = process.cwd();
module.exports = {
publicPath: './',
pages: {
index: 'src/examples/index.js',
},
configureWebpack: config => {
// console.log('config', JSON.stringify(config));
/* if (process.env.NODE_ENV === 'production') {
// 为生产环境修改配置...
} else {
// 为开发环境修改配置...
} */
const resolve = {};
let alias = config.resolve && config.resolve.alias || {};
Object.assign(alias, {
'~': path.resolve(__dirname, _src, './'),
'~comps': path.resolve(__dirname, _src, 'components'),
'~utils': path.resolve(__dirname, _src, 'components/_util'),
'~pages': path.resolve(__dirname, _src, 'examples/pages'),
// 'vue$': 'vue/dist/vue.common.js'
});
config.resolve.alias = alias;
// return config;
},
chainWebpack: webpackConfig => {
// webpackConfig.plugins.delete('prefetch');
webpackConfig.module
.rule('vue')
.test(/\.vue$/)
.use('vue-loader')
.loader('vue-loader')
.options({
compilerOptions: {
preserveWhitespace: false
}
});
},
}