forked from ElemeFE/mint-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcooking.demo.js
53 lines (45 loc) · 1.3 KB
/
cooking.demo.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
var path = require('path');
var cooking = require('cooking');
var Components = require('./components.json');
cooking.set({
use: 'vue',
entry: {
app: './example/entry.js',
vendor: ['vue', 'vue-router', 'fastclick']
},
dist: './example/dist',
template: './example/index.tpl',
devServer: {
port: 8789,
hostname: require('my-local-ip')(),
publicPath: '/',
log: false
},
clean: true,
hash: true,
publicPath: '/mint-ui/',
assetsPath: 'static',
urlLoaderLimit: 10000,
extractCSS: true,
extends: ['vue', 'lint', 'saladcss']
});
cooking.add('resolve.alias', {
'main': path.join(__dirname, 'src'),
'src': path.join(__dirname, 'src'),
'packages': path.join(__dirname, 'packages')
});
cooking.add('preLoader.js.exclude', /node_modules|lib/);
cooking.add('preLoader.vue.exclude', /node_modules|lib/);
var externals = {};
Object.keys(Components).forEach(function (key) {
externals[`packages/${key}/style.css`] = 'null';
});
// 开发模式不需要将不存在的 style.css 打包进去
cooking.add('externals', externals);
if (process.env.NODE_ENV === 'production') {
cooking.remove('entry.vendor');
cooking.add('externals.vue', 'Vue');
cooking.add('externals.vue-router', 'VueRouter');
cooking.add('fastclick', 'FastClick');
}
module.exports = cooking.resolve();