-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
webpack.config.js
43 lines (43 loc) · 1.12 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
var path = require('path');
var HtmlWebpackPlugin = require('../..');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
module.exports = {
context: __dirname,
entry: {
b: './b.js',
d: './d.js',
a: './a.js',
c: './c.js',
e: './e.js'
},
output: {
path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion),
publicPath: '',
filename: '[name].js'
},
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
{ test: /\.png$/, loader: 'file-loader' },
{ test: /\.html$/, loader: 'html-loader' }
]
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
filename: 'first-file.html',
template: 'template.html',
chunksSortMode: 'manual',
chunks: ['a', 'b', 'c']
}),
new HtmlWebpackPlugin({
inject: true,
filename: 'second-file.html',
template: 'template.html',
chunksSortMode: 'manual',
chunks: ['a', 'b', 'd']
}),
new MiniCssExtractPlugin({ filename: 'styles.css' })
]
};