forked from luoxue-victor/workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbox.config.js
96 lines (95 loc) · 2.43 KB
/
box.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const path = require('path')
function resolve (dir) {
return path.join(process.cwd(), dir)
}
module.exports = function (config) {
/**
* @param {object} dll 开启差分包
* @param {object} pages 多页面配置 通过 box run/build index 来使用
* @param {function} chainWebpack
* @param {string} entry 入口
* @param {string} output 出口
* @param {string} publicPath
* @param {string} port 端口
* @param {object} eslint eslint 配置
* @param {object} stylelint stylelint 配置
* @param {object} eslint eslint 配置
* @param {object} alias 配置别名
* @param {object} env 配置通用变量,可以在 node 跟 web 之间共同使用
* @param {Boolean} filenameHashing 文件名是否使用 hash,当文件发生变动的时候 filename 才会改变
* @param {Boolean} css 配置 css
* @param {Boolean} mock 开启 mock
*/
return {
entry: 'src/main.js',
output: 'dist',
publicPath: '/common/',
port: 8888,
mock: true,
env: {
MY_ENV: 'my-env'
},
alias: {
'@': resolve('src'),
'@src': resolve('src')
},
resources: {
less: {
patterns: [
path.resolve(__dirname, './src/global/*.less')
]
},
scss: {
patterns: [
path.resolve(__dirname, './src/global/*.scss')
]
}
},
css: {
sourceMap: true,
loaderOptions: {
css: {},
less: {
globalVars: {
gray: '#ccc'
}
},
sass: {},
postcss: {},
stylus: {}
},
isCssModule: false, // 是否对css进行模块化处理
needInlineMinification: false // 是否需要压缩css
},
filenameHashing: true,
eslint: {
lintOnSave: true, // 开启运行时检测
extensions: ['js', 'jsx', 'vue'] // 默认 ['js', 'jsx']
},
tslint: {
lintOnSave: true, // 开启运行时检测
useThreads: true
},
stylelint: {
lintOnSave: true // 开启运行时检测
// extensions: ['vue', 'htm', 'html', 'css', 'sss', 'less', 'scss']
},
// dll: {
// venders: ['react']
// },
pages: {
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html'
},
index2: {
entry: 'src/main.js',
template: 'public/index2.html',
filename: 'index2.html'
}
},
chainWebpack(config) {
}
}
}