Skip to content

Commit 180ae76

Browse files
Fix: adjust respack config to fix hmr (#162)
* Fix: adjust respack config to fix hmr * Apply suggestion from @puehringer --------- Co-authored-by: Michael Pühringer <[email protected]>
1 parent 751057f commit 180ae76

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

config/rspack.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ module.exports = (webpackEnv, argv) => {
161161
// Add /* filename */ comments to generated require()s in the output.
162162
// TODO: rspack: pathinfo: isEnvDevelopment,
163163
// There will be one main bundle, and one file per asynchronous chunk.
164-
filename: '[name].[contenthash:8].js',
164+
// Fix HMR error in development: https://github.com/webpack/webpack-dev-server/issues/3168#issuecomment-816709164
165+
filename: isEnvDevelopment ? '[name].js' : '[name].[contenthash:8].js',
165166
// There are also additional JS chunk files if you use code splitting.
166-
chunkFilename: '[name].[contenthash:8].chunk.js',
167+
chunkFilename: isEnvDevelopment ? '[name].chunk.js' : '[name].[contenthash:8].chunk.js',
167168
assetModuleFilename: 'assets/[name].[hash][ext]',
168169
// webpack uses `publicPath` to determine where the app is being served from.
169170
// It requires a trailing slash, or the file assets will get an incorrect path.

0 commit comments

Comments
 (0)