-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property 'HMRClient' doesn't exist #501
Comments
Sorry, but I resolved it by disabling HMR -_-, In the ‘webpack.config.mjs’ file, replace: |
I don't have access to a Windows machine atm, but I have an idea what might be happening, can you try doing the following: In entry: [
...Repack.getInitializationEntries(reactNativePath, {
hmr: devServer && devServer.hmr,
}),
entry,
], with entry: [
...Repack.getInitializationEntries(reactNativePath, {
hmr: false,
}),
path.resolve('@callstack/repack/modules/WebpackHMRClient.js'),
entry,
], Please see if that works. The path to |
this doesn't work for me |
This issue has been marked as stale because it has been inactive for 30 days. Please update this issue or it will be automatically closed in 14 days. |
@mikeFromUDig @vinhmdev @peterbd found the root issue. to resolve the error in question please adjust the path of diff --git a/templates/webpack.config.mjs b/templates/webpack.config.mjs
index 18313be..e702a00 100644
--- a/templates/webpack.config.mjs
+++ b/templates/webpack.config.mjs
@@ -159,7 +159,7 @@ export default (env) => {
/node_modules(.*[/\\])+pretty-format/,
/node_modules(.*[/\\])+metro/,
/node_modules(.*[/\\])+abort-controller/,
- /node_modules(.*[/\\])+@callstack\/repack/,
+ /node_modules(.*[/\\])+@callstack[/\\]repack/,
],
use: 'babel-loader',
}, |
Environment
Description
Running into this issue on my windows local environment. Any help would be appreciated
Run steps:
react-native webpack-start --host 127.0.0.1 --webpackConfig ./webpack.config.mjs
in it's own terminalreact-native run-android --no-packager
in it's own terminalApp installs and presents following error on the emulated device
Reproducible Demo
##Webpack Config
`import path from 'path';
import TerserPlugin from 'terser-webpack-plugin';
import * as Repack from '@callstack/repack';
/**
*/
/**
*/
export default (env) => {
const {
mode = 'development',
context = Repack.getDirname(import.meta.url),
entry = './index.js',
platform = process.env.PLATFORM,
minimize = mode === 'production',
devServer = undefined,
bundleFilename = undefined,
sourceMapFilename = undefined,
assetsPath = undefined,
reactNativePath = new URL('./node_modules/react-native', import.meta.url)
.pathname,
} = env;
const dirname = Repack.getDirname(import.meta.url);
if (!platform) {
throw new Error('Missing platform');
}
devServer.hmr
tofalse
.devServer
object is not availablewebpack-bundle
command. Be sure*/
// if (devServer) {
// devServer.hmr = false;
// }
/**
env
in your Babel config, you can remove it.BABEL_ENV
orNODE_ENV
development
orproduction
. Otherwise your production code might be compiled with*/
process.env.BABEL_ENV = mode;
return {
mode,
/**
* This should be always
false
, since the Source Map configuration is done* by
SourceMapDevToolPlugin
./
devtool: false,
context,
/*
*
getInitializationEntries
will return necessary entries with setup and initialization code.* If you don't want to use Hot Module Replacement, set
hmr
option tofalse
. By default,* HMR will be enabled in development mode.
/
entry: [
...Repack.getInitializationEntries(reactNativePath, {
hmr: devServer && devServer.hmr,
}),
entry,
],
resolve: {
/*
*
getResolveOptions
returns additional resolution configuration for React Native.* If it's removed, you won't be able to use
<file>.<platform>.<ext>
(eg:file.ios.js
)* convention and some 3rd-party libraries that specify
react-native
field* in their
package.json
might not work correctly.*/
...Repack.getResolveOptions(platform),
};
};
`
The text was updated successfully, but these errors were encountered: