-
Notifications
You must be signed in to change notification settings - Fork 800
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
Super expression must either be null or a function, not undefined #900
Comments
I'll double check. |
Thanks, maybe I'm missing something. If you need any help, let me know. |
So the problem - React.Component is undefined. Actually - I've fixed this a few months ago, but problem returns. |
Yeah, this is due migration to rollup. Currently we could not target "small" internals, not bound to any external files, and creating a loops in case of babel in node_modules. @neoziro - how you recon - does it worth to went back to simple structure as we have before? |
I think we can solve it using Rollup, but I do not see what is the source of the problem. Can you give me the link to the PR you previously solved it with or describe what we need? |
“The fix” was simply - if Babel plugin could not register anything - it will not add any extra code. |
We're experiencing the same problem while setting up a new webpack4 build config. |
Easiest possible solution - filter out all node_modules inside RHL's babel plugin. |
And that's is the only thing we could and should do. Rollup is not the root cause - not only AppContainer is using "external" modules. |
fix: RHL babel plugin will ignore react and react-hot-loader, fixes #900
@theKashey I'm sorry but I don't see this fixing my example even when installing RHL ver 4.3.3 |
🤷♂️ I'll double check then. |
@theKashey Btw, I don't this is necessarily a bug - I think it's ok to tell people RHL only makes sense in development so they should remove it from production code. I think you just need to communicate it clearly in docs. |
I thought that was clear, and it should remove itself when |
I was also getting this error. I noticed that removing I then checked the documentation for So I tried adding the plugin in my Webpack config... // webpack.config.js
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: '/node_modules/',
+ options: {
+ plugins: ['react-hot-loader/babel'],
+ },
}, And this worked! |
@EddyVinck yeah, that's what I was trying to write in issue description. I think you could also leave it in
|
Could be caused by a circular dependency. Similar error and response from @ljharb on this issue
|
If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.
Description
What you are reporting:
I am either reporting a bug or documentation is misleading.
Expected behavior
What you think should happen: I should be able to build a production version of my app with react-hot-loader and RHL should not be executed in production as it says in docs.
Actual behavior
What actually happens:
I have created simple setup using webpack 4 and react-hot-loader 4. When I run my build script (which is just a standard
webpack
command) and run app in browser I receive error from RHL:Uncaught TypeError: Super expression must either be null or a function, not undefined
This error goes away when I remove
react-hot-loader/babel
fromplugins
entry in.babelrc
. This leads me to believe I should actually have a separate babel setup for production and development.Environment
React Hot Loader version: 4.0.0
Run these commands in the project folder and fill in their results:
node -v
: 8.7.0npm -v
: 5.5.1Then, specify:
Reproducible Demo
Please take the time to create a new project that reproduces the issue.
You can copy your project that experiences the problem and start removing things until you’re left with the minimal reproducible demo. This helps contributors, and you might get to the root of your problem during that process.
Push to GitHub and paste the link here.
https://github.com/apieceofbart/react-hot-loader-webpack-4-example
The text was updated successfully, but these errors were encountered: