-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.js
45 lines (44 loc) · 1.05 KB
/
webpack.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
const { join } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const RefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const { ProvidePlugin, HotModuleReplacementPlugin } = require('webpack');
module.exports = {
mode: 'development',
devtool: 'eval-source-map',
devServer: {
port: 5500,
hot: true,
allowedHosts: ['.loca.lt'],
},
entry: ['./src/index.js'],
resolve: {
extensions: ['.js', '.jsx'],
},
target: ['browserslist', 'es5'],
output: {
path: join(__dirname, 'dist'),
filename: '[name].bundle.js',
chunkFilename: '[name].chunk.bundle.js',
clean: true,
},
optimization: {
splitChunks: {
chunks: 'all',
},
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
plugins: [
new ProvidePlugin({ React: 'react' }),
new HtmlWebpackPlugin({ template: './public/index.html' }),
new HotModuleReplacementPlugin(),
new RefreshWebpackPlugin(),
],
};