-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
82 lines (78 loc) · 1.95 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
71
72
73
74
75
76
77
78
79
80
81
82
// const path = require('path')
const { isProduct } = require('./build/utils')
const { externalMap } = require('./config/index')
const aliasConfig = require('./config/alias')
// function resolve(dir) {
// return path.join(__dirname, dir)
// }
const external = {}
const setAlias = (config) => {
const { alias } = aliasConfig
Object.keys(alias).forEach((key) => {
config.resolve.alias.set(key, alias[key])
})
}
Object.keys(externalMap).forEach((key) => {
if (external[key]) {
external[key] = key
}
})
// node: code below stops process to exit normally
// const threadLoader = require('thread-loader')
// threadLoader.warmup(
// {
// // pool options, like passed to loader options
// // must match loader options to boot the correct pool
// },
// [
// // modules to load
// // can be any module, i. e.
// 'babel-loader',
// 'sass-loader'
// ]
// )
module.exports = {
productionSourceMap: false,
transpileDependencies: ['@x-ui/x-dcloud-ui'],
css: {
loaderOptions: {
sass: {
additionalData: `
@import "@packages/assets/scss/mixin.scss";
@import "@packages/assets/scss/variable/index.scss";
`
}
}
},
chainWebpack: (config) => {
setAlias(config)
// config.resolve.alias
// .set('@', resolve('src'))
// .set('@packages', resolve('packages'))
// .set('@x-gantt-elastic', resolve('./'))
// use multi thread,see https://www.npmjs.com/package/thread-loader
// config.module
// .rule('compile')
// .test(/\.js$/)
// .include
// .add(/src/)
// .end()
// .use('thread')
// .loader('thread-loader')
config.module
.rule('js')
.include.add(/packages/)
.add(/src/)
.end()
.use('babel')
.loader('babel-loader')
.tap((options) => {
return options
})
},
configureWebpack: (config) => {
if (isProduct) {
config.externals = external
}
}
}