joshjg / react-canvas-knob

Flexible knob/dial input component
MIT License
44 stars 28 forks source link

React-Transform-HMR #21

Open DoctorHowser opened 6 years ago

DoctorHowser commented 6 years ago

Hey Folks,

I'm using the react canvas knob component, and have everything working locally. When I make a production build, I get the folowing error:

index.js:51 Uncaught Error: locals[0] does not appear to be amoduleobject with Hot Module replacement API enabled. You should disable react-transform-hmr in production by usingenvsection in Babel configuration. See the example in README: https://github.com/gaearon/react-transform-hmr

A couple questions -- Is using react-transform-hmr needed? Dan Abramov's overall advice to avoid the error is to switch to https://github.com/gaearon/react-hot-loader

If it's not possible to change dependencies, we should document that this code will break in production environments/needs to have production configuration. Does this exist someplace and I missed it?

Thanks!

funador commented 6 years ago

Facing the same problem deploying to Netlify ^^

funador commented 6 years ago

@DoctorHowser probably not the perfect solution but I just copied this file into my project. Avoid babel altogether as it is not needed for create react app (assuming you are also using that): https://github.com/joshjg/react-canvas-knob/blob/master/Knob.js

strongui commented 6 years ago

@funador thank you, I couldn't figure out where this error was coming from.

abdu355 commented 6 years ago

@DoctorHowser probably not the perfect solution but I just copied this file into my project. Avoid babel altogether as it is not needed for create react app (assuming you are also using that): https://github.com/joshjg/react-canvas-knob/blob/master/Knob.js

@funador thank you! Could have saved 3 hrs if I had just done what you did. I dived deep into babel's and webpack's configuration mess.

hatamsoyunov commented 4 years ago

@funador thank you 🙏 Sometimes you need to think easier)) We usually try to solve it in a difficult way)) and the solution is sometimes very close.

sunshinelancer828 commented 2 years ago

Hi, @DoctorHowser , @abdu355, @funador how are you today, I faced same issue with @DoctorHowser . so I read @funador 's comment. but I don't know where should I copy the Knob.js. could you tell me about it in detail? thanks.