-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvue.config.js
70 lines (60 loc) · 1.61 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* eslint-disable @typescript-eslint/no-var-requires */
module.exports = {
publicPath: '',
pages: {
index: {
entry: 'example',
},
},
productionSourceMap: false,
css: {
sourceMap: process.env.NODE_ENV !== 'production',
extract: false,
},
chainWebpack: (config) => {
config.module.rule('js').exclude.add(/dist/)
config.module.rule('md').test(/\.md$/)
config.module.rule('md').use('html-loader').loader('html-loader')
config.module.rule('md').use('markdown-loader').loader('markdown-loader')
config.performance.hints(false)
},
configureWebpack: (config) => {
config.externals = config.externals || {}
config.externals = [
config.externals,
{
vue: {
root: 'Vue',
amd: 'vue',
commonjs: 'vue',
commonjs2: 'vue',
},
},
]
if (process.env.BUILD_MODE === 'component') {
const nodeExternals = require('webpack-node-externals')
config.externals.push({
'element-ui': {
root: 'ELEMENT',
commonjs: 'element-ui',
commonjs2: 'element-ui',
amd: 'element-ui',
},
})
config.externals.push(
nodeExternals({
allowlist: [/^@babel/, /current-script-polyfill/],
})
)
}
const version =
process.env.TARGET_VERSION || require('./package.json').version
const banner = `Vue Listview v${version}`
const webpack = require('webpack')
config.plugins.push(new webpack.BannerPlugin(banner))
},
devServer: {
disableHostCheck: true,
before: require('./tests/mock-api'),
},
}