yo.base.conf.js
2.03 KB
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
const yo = require('yo-cli');
const webpack = require('webpack');
const path = require('path');
const config = require('../config/common');
module.exports = yo()
.entry('./public/app.js')
.output({
path: `dist/statics/${config.appName}/`,
publicPath: config.assetUrl
})
.style({
extract: true
})
.js({
chunk: {
runtime: false,
cacheGroups: {
default: false,
commons: {
chunks: 'all',
name: 'vendors',
test: /node_modules\/(yoho-jquery[$\/]|core-js|yoho-cookie|yoho-qs|babel-runtime|yoho-jquery-lazyload)/, //eslint-disable-line
},
vue: {
priority: 1,
chunks: 'all',
name: 'vue',
test: /node_modules\/vue/,
},
eachart: {
priority: 1,
chunks: 'all',
name: 'eachart',
test: /node_modules\/(echart|zrender)/,
},
swiper: {
priority: 1,
chunks: 'all',
name: 'swiper',
test: /node_modules\/(yoho-swiper)/,
}
}
}
})
.resolve({
modules: [
path.join(__dirname, '../public'),
]
})
.vue()
.hbs({
helperDirs: [
path.join(__dirname, '../public/js/common/helpers')
],
partialDirs: [
path.join(__dirname, '../doraemon/views/partial')
]
})
.merge({
plugins: [
new webpack.ProvidePlugin({
$: 'yoho-jquery',
jQuery: 'yoho-jquery',
'window.jQuery': 'yoho-jquery'
}),
],
module: {
rules: [{
test: /yoho\.entry\.js/,
loader: path.resolve(__dirname, './yoho-entry-loader'),
}]
}
});