-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.client.js
More file actions
35 lines (31 loc) · 952 Bytes
/
webpack.client.js
File metadata and controls
35 lines (31 loc) · 952 Bytes
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
const path = require('path');
const webpack = require('webpack');
const rootPath = path.join(__dirname);
// This connects to the server to receive notifications
// when the bundle rebuilds and then updates your client bundle accordingly.
const hotMiddlewareScript = `webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true`;
console.log('핫 미들웨어', process.env.NODE_ENV);
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: [hotMiddlewareScript, './src/index.tsx'],
output: {
path: path.resolve(rootPath, 'dist'),
filename: '[name].js',
publicPath: '/',
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'swc-loader',
},
},
],
},
resolve: {
extensions: ['.js', 'jsx', '.ts', '.tsx'],
},
plugins: [new webpack.HotModuleReplacementPlugin()],
};