-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.common.js
57 lines (54 loc) · 1.24 KB
/
webpack.common.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
'use strict';
const HtmlPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
module.exports = {
entry: {
index: './app/index.jsx',
},
output: {
filename: '[name].[hash].js',
chunkFilename: '[name].[chunkhash].js',
hashDigestLength: 8,
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [{
loader: 'babel-loader',
options: {
presets: ['react', 'env'],
plugins: ['react-hot-loader/babel'],
},
}],
},
{
test: /\.s?css$/,
use: ['css-hot-loader', MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
{
test: /\.(jpe?g|gif|png|eot|svg|ttf|woff2?)$/,
use: [{
loader: 'file-loader',
options: { name: '[name].[hash:8].[ext]' },
}],
},
],
},
optimization: {
splitChunks: { chunks: 'all' },
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new HtmlPlugin({
template: './app/index.ejs',
favicon: './app/static/favicon.ico',
}),
],
};