mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(webpack5): include hmr handling only when enabled (#9685)
* fix(webpack): respect hmr flag * fix(webpack): ensure correct loader order is used * chore: cleanup Co-authored-by: Igor Randjelovic <rigor789@gmail.com>
This commit is contained in:
@@ -34,18 +34,21 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
|
||||
virtualEntryPath
|
||||
);
|
||||
|
||||
// set up core HMR
|
||||
config.module
|
||||
.rule('hmr-core')
|
||||
.test(/\.js$/)
|
||||
.exclude.add(/node_modules/)
|
||||
.add(entryPath)
|
||||
.end()
|
||||
.use('nativescript-hot-loader')
|
||||
.loader('nativescript-hot-loader')
|
||||
.options({
|
||||
appPath: getEntryDirPath(),
|
||||
});
|
||||
config.when(env.hmr, (config) => {
|
||||
// set up core HMR
|
||||
config.module
|
||||
.rule('hmr-core')
|
||||
.before('js')
|
||||
.test(/\.js$/)
|
||||
.exclude.add(/node_modules/)
|
||||
.add(entryPath)
|
||||
.end()
|
||||
.use('nativescript-hot-loader')
|
||||
.loader('nativescript-hot-loader')
|
||||
.options({
|
||||
appPath: getEntryDirPath(),
|
||||
});
|
||||
});
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user