Skip to content

Commit 7be1859

Browse files
update(other): 🧩 update webpack development config
fix issue react-refresh run wrong, by removing splitchunks components
1 parent c5314c9 commit 7be1859

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

config/webpack.development.config.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const WebpackDevelopmentConfiguration = async () => {
3939
output: {
4040
publicPath: '/',
4141
module: true,
42-
// library: { type: 'module' },
4342
environment: {
4443
dynamicImport: true,
4544
},
@@ -64,7 +63,10 @@ const WebpackDevelopmentConfiguration = async () => {
6463
hot: true,
6564
liveReload: false,
6665
host: process.env.PROJECT_IPV4_HOST,
67-
client: { overlay: false }, // NOTE - Use overlay of react refresh plugin
66+
client: {
67+
overlay: false,
68+
logging: 'warn', // Want to set this to 'warn' or 'error'
69+
}, // NOTE - Use overlay of react refresh plugin
6870
historyApiFallback: true,
6971
devMiddleware: {
7072
publicPath: '/',
@@ -99,6 +101,12 @@ const WebpackDevelopmentConfiguration = async () => {
99101
decorators: false,
100102
dynamicImport: true,
101103
},
104+
transform: {
105+
react: {
106+
development: true,
107+
refresh: true,
108+
},
109+
},
102110
target: 'esnext',
103111
},
104112
},
@@ -139,7 +147,7 @@ const WebpackDevelopmentConfiguration = async () => {
139147
// excludeChunks: ["socket.io-client"],
140148
}),
141149
RecompileLoadingScreenInitial,
142-
new ReactRefreshPlugin(),
150+
new ReactRefreshPlugin({ esModule: true, overlay: true }),
143151
new WebpackCustomizeDefinePlugin({
144152
'import.meta.env': WebpackCustomizeDefinePlugin.RuntimeUpdateValue(
145153
() => {
@@ -230,13 +238,6 @@ const WebpackDevelopmentConfiguration = async () => {
230238
reuseExistingChunk: true,
231239
enforce: true,
232240
},
233-
components: {
234-
chunks: 'async',
235-
test: /[\\/]components[\\/]/,
236-
name: 'components',
237-
reuseExistingChunk: true,
238-
enforce: true,
239-
},
240241
}, // cacheGroups
241242
},
242243
},

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"prettier": "^2.7.1",
6565
"purgecss-webpack-plugin": "^5.0.0",
6666
"quicktype-core": "^6.0.62",
67-
"react-refresh": "^0.14.0",
6867
"socket.io": "^4.5.3",
6968
"swc-loader": "^0.2.3",
7069
"tailwindcss": "^3.2.3",
@@ -78,7 +77,7 @@
7877
"polished": "^4.2.2",
7978
"react": "^18.2.0",
8079
"react-dom": "^18.2.0",
81-
"react-router-dom": "^6.6.1",
80+
"react-router-dom": "^6.8.0",
8281
"styled-components": "^5.3.6"
8382
},
8483
"eslintConfig": {

0 commit comments

Comments
 (0)