yo.base.conf.js
2.75 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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({
preLoaders: {
scss: true
}
})
.resolve({
alias: {
vue: 'vue/dist/vue.common.js',
'@dist': path.join(__dirname, '../dist'),
},
modules: [
path.join(__dirname, '../node_modules'),
path.join(__dirname, '../public'),
]
})
.js({
babel: {
exclude: [/node_modules/],
}
})
.vue()
.html(false)
.merge({
plugins: [
new webpack.ProvidePlugin({
$: 'yoho-jquery',
jQuery: 'yoho-jquery',
'window.jQuery': 'yoho-jquery'
}),
],
optimization: {
splitChunks: {
chunks() {
return false;
},
cacheGroups: {
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)/,
}
}
}
},
module: {
rules: [{
test: /\.hbs$/,
use: {
loader: 'handlebars-loader',
options: {
helperDirs: [
path.join(__dirname, '../public/js/common/helpers')
],
partialDirs: [
path.join(__dirname, '../doraemon/views/partial')
]
}
},
}, {
test: /yoho\.entry\.js/,
loader: path.resolve(__dirname, './yoho-entry-loader'),
}]
}
});