Bug: Fast Refresh Breaks - unclear why
stephencweiss opened this issue · comments
Stephen Weiss commented
React version: 17.0.2
Steps To Reproduce
Link to code example: Have not been able to reproduce reliably.
The current behavior
When I have a custom hook, Parcel seems to choke on Fast Refresh
The expected behavior
Custom hooks work fine.
Additional details
{
"name": "launcher",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "parcel index.html --no-cache --no-hmr",
"start:mirage": "export MIRAGE=true && yarn run start",
"build": "parcel build index.html",
"clean": "rm -rf .parcel-cache dist"
},
"dependencies": {
"lodash": "^4.17.21",
"miragejs": "^0.1.41",
"react-app-polyfill": "^1.0.0"
},
"alias": {
"redux-thunk": "../node_modules/redux-thunk",
"react": "../node_modules/react",
"react-redux": "../node_modules/react-redux",
"react-dom": "../node_modules/react-dom/profiling",
"scheduler/tracing": "../node_modules/scheduler/tracing-profiling"
},
"devDependencies": {
"@parcel/transformer-sass": "2.0.0-beta.2",
"@types/lodash": "^4.14.170",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.8.4",
"dotenv": "^10.0.0",
"faker": "^5.5.3",
"parcel": "^2.0.0-beta.2",
"typescript": "^3.4.5"
},
"volta": {
"node": "12.22.3"
}
}
note: My solution was to update the start script to include --no-hmr
There's nothing unique about this config beyond what's set up by TSDX.
dan commented
I don't see a reason to believe this is related to React, since the error is in Parcel. It's up to Parcel to guarantee the globals are defined at an appropriate time.
Stephen Weiss commented
@gaearon - Totally valid response! I wanted to share as much for visibility as anything.
Appreciate you!