-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
50 lines (42 loc) · 884 Bytes
/
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
const webpack = require('webpack')
let commitHash
function cmdOutput (cmd) {
const out = require('child_process')
.execSync(cmd)
.toString()
.replace(/\n/g, '')
return JSON.stringify(out).trim() || '0'
}
try {
commitHash = cmdOutput('git rev-parse --short HEAD') || 'unknown'
} catch (e) {
commitHash = 'unknown'
}
const buildTime = cmdOutput('date +%s')
module.exports = {
lintOnSave: false,
assetsDir: '_docs',
pluginOptions: {
i18n: {
locale: 'zh',
fallbackLocale: 'zh',
localeDir: 'locales',
enableInSFC: false
}
},
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
GIT_COMMIT: commitHash,
BUILD_TIME: buildTime
})
]
},
chainWebpack: config => {
config.module
.rule('md')
.test(/\.md$/)
.use('raw-loader')
.loader('raw-loader')
}
}