Comments (5)
I suspect this is also the cause of #11.
from react-refresh-webpack-plugin.
First, thank you so much for your work on this project. I'm so excited to use it! 💙
While setting it up, I noticed what I think is an issue with the current logic around
BabelDetectComponent
.The detection works by checking whether a "component" in
BabelDetectComponent.js
(part of the react-refresh-webpack-plugin aka RRWP runtime) was transformed byreact-refresh/babel
. Note that, when RRWP is installed by a consumer,BabelDetectComponent.js
will end up innode_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/
.The issue is that, in general, the
react-refresh/babel
transform shouldn't be applied tonode_modules/
. (For example, the example in the readme applies the transform to a webpack rule that excludes/node_modules/
.) Unless a RRWP consumer has their build configured incorrectly,BabelDetectComponent.js
will never get transformed, and the "refresh check" check will always fail.The example in this repo happens to work because it uses a local version of the runtime so the runtime modules don't match the loader exclusion rule.
For now, I can work around this by setting
disableRefreshCheck: true
.
Yes - I am fully aware of this. #17 tries to fix this by making the error non-blocking, but unfortunately I cannot think of a robust way to detect a Babel transform being applied. I would appreciate if anyone have any ideas on that.
from react-refresh-webpack-plugin.
Yes - I am fully aware of this. #17 tries to fix this
Sorry, I checked for issues but not PRs.
I would appreciate if anyone have any ideas on that.
Haven't written a webpack plugin so I don't know if this is possible, but could the plugin inject the content of BabelDetectComponent.js
directly into the consumer's webpack entry point module before it gets processed by loaders, and then later check whether that module was transformed to reference the runtime?
Or is there a way for the plugin to fake the existence of a module at a local path (./BabelDetectComponent.js
relative to the entry file), and inject an import to that path in the entry file?
from react-refresh-webpack-plugin.
Could the plugin inject the content of
BabelDetectComponent.js
directly into the consumer's webpack entry point module before it gets processed by loaders, and then later check whether that module was transformed to reference the runtime?
I would rather not do it that way - content injection will most likely screw up users' setup and also source maps.
Or is there a way for the plugin to fake the existence of a module at a local path (
./BabelDetectComponent.js
relative to the entry file), and inject an import to that path in the entry file?
Symlinks could work, but users will have to ignore that file or we have to somehow delete it, then it would raise the problem of false-positives by deleting users' files.
For reference, I am testing to use @babel/core
to grab the config and see if it is possible to check what plugins have been injected. I have been quite fully occupied by work the past week, so I can't guarantee I can sort this out quickly.
from react-refresh-webpack-plugin.
#60 makes this obsolete because the checking have been removed.
from react-refresh-webpack-plugin.
Related Issues (20)
- Cannot read properties of undefined (reading 'call') at at options.factory HOT 1
- Relative imports outside of src/ are not supported. HOT 6
- Can I use a custom domain and SSL cert for the cable URL? HOT 1
- Tsc error when upgraded to 0.5.X from 0.4.X HOT 1
- Is that possible to refresh when files in node_modules are changed?
- Rewrite window.fetch method It will not work!
- Using with webpack-hot-middleware, issues
- npm ERR! ERESOLVE could not resolve HOT 1
- Security vulnerability - loader-utils 2.0.4 HOT 2
- Getting lot's of *.hot-update.js files in dist folder HOT 1
- Not working with multiple entry points in webpack where one entry does not use react
- Expand webpack-dev-server dev dependency to include the newes semver 5.x HOT 1
- erroroverlay
- There are some edge cases where we have to manually refresh the page to see the change. HOT 1
- Issues when combining webpack HMR and react-refresh-webpack-plugin HOT 10
- `useEffect` inside refreshed code runs needlessly HOT 1
- Alternative for React Class Components. HOT 1
- Issues with peer dependencies found HOT 1
- Memory cleanup doesn't happen on incremental compiles HOT 3
- Using the external configuration item of webpack in the development environment can cause react refresh to fail HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-refresh-webpack-plugin.