-
Notifications
You must be signed in to change notification settings - Fork 191
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
React refresh not compatible with @babel/preset-flow #136
Comments
Oh and the error is:
|
Along these lines, as I was fiddling around with the example, I noticed that the output that is attempting to be parsed does not have the If you were to update module.exports = (api) => {
// This caches the Babel config
api.cache.using(() => process.env.NODE_ENV);
return {
presets: ['@babel/preset-env', '@babel/preset-react', ['@babel/preset-flow', {all: true}]],
// Applies the react-refresh Babel plugin on non-production modes only
...(!api.env('production') && { plugins: ['react-refresh/babel'] }),
};
}; However, this is not expected functionality, and setting |
Not really stripping it away, we inject runtime code (with a loader that runs before Babel) at the start of files so the We might have to hard-code something along the lines of I'll fix it tomorrow. |
@pmmmwh thanks so much for the attention on this. Would it be possible to inject that runtime code after top-of-file comment lines/blocks? I'm not trying to come off as a begger by any means, but just thinking of a way to make it too stiff from hard-coded solutions. |
The issue is that we don't parse the file, so we have no idea if there exist a top-of-file comment. I'll see if we can work around that without doing string manipulation but it seems difficult at first glance. |
Fixed in |
If I include
@babel/preset-flow
in thewebpack-dev-server
example, webpack fails to build it. If I remove hot reloading, webpack succeeds. I've created a small reproducible test case here:https://github.com/michaelgmiller1/react-refresh-webpack-plugin/commits/flow-break
I think this is the last remaining issue for us to adopt React Refresh in our app!! Thanks again for all your work fixing my bug reports!
The text was updated successfully, but these errors were encountered: