Comments (3)
If you look at the customize-cra-react-refresh
package, you'll see it makes two changes to your config:
- the
react-refresh/babel
Babel plugin is added - the
@pmmmwh/react-refresh-webpack-plugin
plugin is added
After installing these two dependencies, you should be able to do the following:
const {appendWebpackPlugin} = require(@rescripts/utils);
const ReactRefreshPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const isDevelopment = process.env.NODE_ENV !== "production";
module.exports = [
['use-babel-config', '.babelrc'],
isDevelopment
? [appendWebpackPlugin(new ReactRefreshPlugin(...yourOptions))]
: config => config
]
Finally, specify the react-refresh
babel plugin in your .babelrc
.
[
"plugins": [
"react-app",
"react-refresh/babel"
]
]
Please try this out and let me know if you need more help
from rescripts.
@harrysolovay It works pretty well on a CRA
app!
https://github.com/jizusun/react-typescript-fast-refresh/pull/2/files
Thank you for this great project!
By the way, only a small typo in your answer 😄
- const {appendWebpackPlugin} = require(@rescripts/utils);
+ const {appendWebpackPlugin} = require('@rescripts/utilities')
from rescripts.
Hi @harrysolovay Excuse me, but I just found it very strange
rescripts + react-refresh-webpack-plugin + react-hook-form
: doesn't work ❌
jizusun/react-typescript-fast-refresh#3customize-cra + customize-cra-react-refresh + react-hook-form
: works ✅
jizusun/react-typescript-fast-refresh#5
Maybe I should dive deep into the code, but do you have any guess about why doesn't it work?
My guess is customize-cra-react-refresh
use a pretty old react-refresh-webpack-plugin
And how can I try rescripts + customize-cra-react-refresh
?
Thanks so much for your help ❤️
from rescripts.
Related Issues (20)
- Compatibility with custom react-scripts forks HOT 1
- Show error output for rescript config errors HOT 3
- Global configuration not taken into account HOT 1
- Dev server hangs when trying to add another entry point HOT 4
- react-dev-utils need to be updated HOT 1
- .babelrc.js export function does not work HOT 3
- Adding ".babelrc" breaks typescript support in react HOT 1
- Allow react-scripts v4 without npm warning
- Typescript update to 4.X? HOT 1
- Install the last version of react-dev-utils to fix a vulnerability HOT 2
- No matching version for @rescripts/rescript-use-eslint-config dependency in @rescripts/rescript-env HOT 7
- How do I extend the jest config? HOT 1
- Setting a static name for the files generated by build HOT 2
- Webpack config HOT 4
- how to config webpack devServer' before(app) HOT 6
- PostCSS config not working HOT 1
- [Question] Multiple entry points + shared/common chunks howto example for noobs HOT 1
- Is there any way how to easily change paths? HOT 3
- How to add a devserver before or after hook? HOT 1
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 rescripts.