react-canvas-knob icon indicating copy to clipboard operation
react-canvas-knob copied to clipboard

React-Transform-HMR

Open DoctorHowser opened this issue 6 years ago • 6 comments

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 a moduleobject with Hot Module replacement API enabled. You should disable react-transform-hmr in production by usingenv section 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!

DoctorHowser avatar May 15 '18 21:05 DoctorHowser

Facing the same problem deploying to Netlify ^^

funador avatar May 16 '18 16:05 funador

@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 avatar May 16 '18 16:05 funador

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

strongui avatar May 19 '18 03:05 strongui

@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.

abdu355 avatar Sep 22 '18 01:09 abdu355

@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.

hatamsoyunov avatar Nov 18 '19 20:11 hatamsoyunov

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.

sunshinelancer828 avatar Mar 26 '22 14:03 sunshinelancer828