-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvue.config.js
More file actions
33 lines (30 loc) · 877 Bytes
/
vue.config.js
File metadata and controls
33 lines (30 loc) · 877 Bytes
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
const path = require('path')
const { execSync } = require('child_process')
const rules = []
if (process.env.NODE_ENV === 'test') {
rules.push({
test: /\.(js|ts)$/,
include: path.resolve('src'),
loader: 'istanbul-instrumenter-loader',
query: {
esModules: true
}
})
}
module.exports = {
chainWebpack: config => {
config.resolve.alias
.set('@util', path.resolve(__dirname, 'src/util'))
.set('@router', path.resolve(__dirname, 'src/router.js'))
config.plugin('define').tap(args => {
args[0]['process.env.VUE_APP_COMMIT_HASH'] = JSON.stringify(execSync('git rev-parse HEAD').toString().trim())
args[0]['process.env.VUE_APP_COMMIT_HASH_SHORT'] = JSON.stringify(execSync('git rev-parse --short HEAD').toString().trim())
return args
})
},
configureWebpack: {
module: {
rules: rules
}
}
}