-
Notifications
You must be signed in to change notification settings - Fork 801
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
Moving hook call to another module and importing result breaks RHL #1280
Comments
I recon this is a babel plugin :) Could you please:
.map(function (call) {
return call.callee;
})
/// to
.map(function (call) {
return t.cloneDeep(call.callee);
}) If that would fix the problem - that would be great! I've tried to reproduce your case, but with no luck. You may also just copy here transpiled version of your component, problem should be there. PS: This was "fixed" at #1268 just a few days ago, but, look like, not in full. |
FYI, Before this change, every 2 file saves (no exception) showed that error above. With the fix above, I re-ran Parcel (the bundler I'm using) and I got the error once and never again. I quit Parcel server, re-ran again and never got the error again. So I guess that actually fixed the problem? 😃 |
Sounds like a cache. |
Yeah, it was a cache issue :)
{
"plugins": [
"react-hot-loader/babel"
],
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
]
}
"alias": {
"react-dom": "@hot-loader/react-dom"
},
"dependencies": {
"@hot-loader/react-dom": "16.8.6",
"@material-ui/core": "4.1.3",
"@material-ui/icons": "4.2.1",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-hot-loader": "4.12.0"
},
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": [
"dom",
"es2017"
],
"module": "es6",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "./dist/",
"removeComments": true,
"sourceMap": true,
"strict": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5"
},
"exclude": [
".cache",
"dist",
"node_modules",
"temp"
],
"include": [
"./src/**/*"
]
} |
And just to double-double check - you already had ‘t.clone’ there, and just made it more “deep”? |
No, I had |
Description
I'm using Material-UI and the
makeStyles
hook to style my application. Everything is working fine when themakeStyles
call is in the same file I'll be using it's output. When I place this call in a different file and import the result, RHL breaks.For instance, take this
Application.tsx
file:Note: As you can see I'm using TypeScript with React.
The example above works just fine with RHL, no issues whatsoever.
But now I've changed
Application.tsx
to this:And
Application.styles.ts
:Expected behavior
What you think should happen:
When saving
Application.tsx
file, RHL should work as expected and without any errors.Actual behavior
What actually happens:
When saving
Application.tsx
file, RHL shows this error:Environment
React Hot Loader version: v4.12.0
Run these commands in the project folder and fill in their results:
node -v
: v10.15.0yarn -v
: v1.16.0Then, specify:
Reproducible Demo
I apologize in advanced for not having a demo project yet. If one is really necessary, please let me know and I'll get it pushed as soon as I'm able to.
The text was updated successfully, but these errors were encountered: