-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.base.config.js
53 lines (50 loc) · 1.32 KB
/
webpack.base.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
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const dlls = require('./config.js').dlls.map(item => item.key);
const config = {
entry: {
app: ['babel-polyfill', './src/index.jsx']
},
module: {
rules: [
{
test: /\.(js|jsx)?$/,
use: ['babel-loader'],
},
{
test: /\.(png|jpg|gif)$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
name: 'images/[name]-[hash].[ext]'
}
}]
}
]
},
output: {
filename: 'js/[name].js',
path: path.resolve(__dirname, './dist/'),
publicPath: '/'
},
plugins: [
new htmlWebpackPlugin({
template: path.resolve('./src/index.html'),
hash: false,
filename: 'index.html',
inject: 'body'
}),
],
stats: "errors-only",
resolve: {
extensions: ['.jsx', '.less', '.js']
}
};
dlls.forEach(key => {
config.plugins.push(new webpack.DllReferencePlugin({
manifest: require(`./dll/${key}/dll-manifest.json`)
}))
})
module.exports = config;