-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathvue.config.js
52 lines (45 loc) · 1.05 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
const path = require('path');
const WebpackShellPlugin = require('webpack-shell-plugin');
const base = {
publicPath:'',
runtimeCompiler:true,
css:{extract:false},
// publicPath: process.env.NODE_ENV === 'production' ? '/static/' : '/',
assetsDir:'static',
filenameHashing:false,
chainWebpack: config => {
config.plugin('html')
.tap(args => {
args[0].template = path.join(__dirname, 'index.html');
console.log(args);
return args;
})
config
.plugin('copy')
.tap(args => {
// Changing default copy path to dist/static
args[0][0].to += `${path.sep}static`;
return args;
});
}
}
if(process.env.NODE_ENV === 'production'){
module.exports = Object.assign(base, {
productionSourceMap: false,
configureWebpack:{
output: {
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js',
},
plugins:[
new WebpackShellPlugin({
// onBuildStart:['node scripts/pre-pack'],
// onBuildEnd:['node scripts/post-pack']
}),
]
},
})
} else {
module.exports = Object.assign(base, {
})
}