-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
65 lines (63 loc) · 1.73 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
const path = require('path');
const MiniCSSEtractPlugin = require('mini-css-extract-plugin');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
module.exports = {
mode,
entry: path.resolve(__dirname, 'src/index.js'),
output: {
path: path.resolve(__dirname, 'dist', 'client'),
assetModuleFilename: 'assets/[hash][ext]',
clean: true
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: [
"@babel/preset-env",
"@babel/preset-react"
]
}
}
},
{
test: /\.s?css/,
use: [
MiniCSSEtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
{
test: /\.(png|jpg|jpeg|svg|gif)$/i,
type: 'asset/resource'
},
{
test: /\.(otf|ttf|eot|woff)$/i,
type: 'asset/resource'
}
]
},
plugins: [
new MiniCSSEtractPlugin({
filename: 'css/[name].css'
}),
new HTMLWebpackPlugin({
template: path.resolve(__dirname, 'public/index.html')
})
],
devtool: 'eval-source-map',
devServer: {
port: 4300,
progress: true,
open: true,
host: '0.0.0.0',
historyApiFallback: true,
contentBase: './',
hot: true
}
}