-
Notifications
You must be signed in to change notification settings - Fork 801
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
Breaks with .mjs
#1102
Comments
It sounds like
Would affect both babel and webpack logic. |
I'm facing the same issue, is there any workaround? |
probably it's time to use a |
I'm sorry, but I don't understand what |
const plugins = [
["react-hot-loader/babel", {safetyNet: false}]
]; The new (4.6.5) version is I've just tested your demo - one change to babelrc and it works! |
This also solved my issue. My error showed "module is not defined". Thanks a bunch @theKashey |
After upgrading webpack and plugins/loaders, there was an error from react-hot-loader: ReferenceError: module is not defined A known workaround is to enable safetyNet [1] so the code referencing `module` is not executed. I'm not sure why this was not shown before the webpack upgrades, but don't feel like digging deeper to find out. [1]: gaearon/react-hot-loader#1102 (comment)
After upgrading webpack and plugins/loaders, there was an error from react-hot-loader: ReferenceError: module is not defined A known workaround is to enable safetyNet [1] so the code referencing `module` is not executed. I'm not sure why this was not shown before the webpack upgrades, but don't feel like digging deeper to find out. [1]: gaearon/react-hot-loader#1102 (comment)
After upgrading webpack and plugins/loaders, there was an error from react-hot-loader: ReferenceError: module is not defined A known workaround is to enable safetyNet [1] so the code referencing `module` is not executed. I'm not sure why this was not shown before the webpack upgrades, but don't feel like digging deeper to find out. [1]: gaearon/react-hot-loader#1102 (comment)
After upgrading webpack and plugins/loaders, there was an error from react-hot-loader: ReferenceError: module is not defined A known workaround is to enable safetyNet [1] so the code referencing `module` is not executed. I'm not sure why this was not shown before the webpack upgrades, but don't feel like digging deeper to find out. [1]: gaearon/react-hot-loader#1102 (comment)
After upgrading webpack and plugins/loaders, there was an error from react-hot-loader: ReferenceError: module is not defined A known workaround is to enable safetyNet [1] so the code referencing `module` is not executed. I'm not sure why this was not shown before the webpack upgrades, but don't feel like digging deeper to find out. [1]: gaearon/react-hot-loader#1102 (comment)
After upgrading webpack and plugins/loaders, there was an error from react-hot-loader: ReferenceError: module is not defined A known workaround is to enable safetyNet [1] so the code referencing `module` is not executed. I'm not sure why this was not shown before the webpack upgrades, but don't feel like digging deeper to find out. [1]: gaearon/react-hot-loader#1102 (comment)
Description
react-hot-loader breaks the execution of any project that includes a
.mjs
file.Expected behavior
One should be able to import
.mjs
files. These are more and more common. Eg. GraphQL is publishing.mjs
files.Actual behavior
It breaks the execution of the app (not the compilation). I think the main reason is that Webpack has a special kind of hidden mode for
.mjs
file and will entirely ignore anyrequire
(which react-hot-loader is injecting). For example, when using GraphQL:When inspecting the code, it is clear that
require
is not being properly compiled. Here is one of graphql modules as imported in my project:It should be
__webpack__require__
. The behaviour is intended in Webpack. I believe the new rule is that norequire
should never be injected in a.mjs
file.Environment
React Hot Loader version: 4.3.12
Run these commands in the project folder and fill in their results:
node -v
: v8.11.3npm -v
: 5.6.0Then, specify:
Reproducible Demo
https://github.com/QuentinRoy/react-hot-loader-mjs-crash
The text was updated successfully, but these errors were encountered: