-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
69 lines (59 loc) · 1.52 KB
/
webpack.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
const webpack = require('atool-build/lib/webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
//html插件
const htmlwebpackplugin = require('html-webpack-plugin');
const fs = require('fs');
var path = require('path');
const glob = require('glob');
module.exports = function(webpackConfig) {
//transform-runtime
webpackConfig.babel.plugins.push('transform-runtime');
//antd
webpackConfig.babel.plugins.push(['antd', {style: 'css',}]);
// Enable this if you have to support IE8.
webpackConfig.module.loaders.unshift({
test: /\.jsx?$/,
loader: 'es3ify-loader',
});
//分类文件夹,填写对应的from位置
webpackConfig.plugins.unshift(
new CopyWebpackPlugin([
{
from: './favicon.ico'
},
{
from: './static/css',
to: './css'
},
{
from: './static/js',
to: './js'
},
{
from: './static/img',
to: './images'
},
{
from: './static/iconfont',
to: './iconfont'
}])
);
//多页面入口--首页和用户页面
webpackConfig.plugins.push(
new htmlwebpackplugin({
filename:'index.html',
template: './src/page/index.ejs',
inject: "body",
chunks:['index'],
excludeChunks:['common']
}),
new htmlwebpackplugin({
filename:'user.html',
template: './src/page/user.ejs',
inject: "body",
chunks:['user'],
excludeChunks:['common']
})
);
return webpackConfig;
};