generated from sumeyradavran/webpack-typescript-react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
52 lines (50 loc) · 1.27 KB
/
webpack.dev.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
const { merge } = require('webpack-merge')
const commonConfig = require('./webpack.base.config')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin')
module.exports = () => {
return merge(commonConfig, {
mode: 'development',
output: {
filename: '[name].js',
chunkFilename: '[name].chunk.js',
},
devtool: 'eval-cheap-module-source-map',
optimization: {
runtimeChunk: true,
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false,
},
devServer: {
port: process.env.PORT || 3000,
open: true,
hot: true,
historyApiFallback: true,
},
module: {
rules: [
{
test: /\.(css)$/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(s(a|c)ss)$/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
filename: './index.html',
inject: true,
}),
new ReactRefreshWebpackPlugin({
overlay: false,
}),
],
})
}