-
Notifications
You must be signed in to change notification settings - Fork 8
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
React Hot Loader isn't configured correctly #17
Comments
I am having an issue with this
when I do |
Hi @maketroli , react-hot-loader has to be used only in development mode. In order to deploy to heroku, make sure to deploy this way:
npm run build it will create a dist folder with everything inside.
Then Heroku will use this 'Procfile 'file https://github.com/darul75/web-react/blob/master/Procfile You can also check here https://github.com/darul75/web-react/blob/master/package.json#L16 "start": "node dist/server.js", I hope it will help |
I have this error when I enter to that url after running npm run start
|
on heroku you deploy a production app, don't you ? npm run build bundles your app for production and in this case default port is 3000 but you can change it if you want https://github.com/darul75/web-react/blob/master/server/server.js#L15 app.set('port', process.env.PORT || 3000); |
I run when that push is on the terminal, I get the error I pasted in my first question. And in Heroku web app I get this
and in Heroku Logs there is an error like this
|
I try to reproduce your case, give me time :) in the meantime can you take a look at the following. Maybe react-helmet is not configured well https://github.com/darul75/web-react/blob/master/server/utils/renderer.js#L83 react-helmet is used for head metadatas instrumentation and I have choosen to write a configuration file named config.json https://github.com/darul75/web-react/search?utf8=%E2%9C%93&q=config.json maybe you are not requiring it anywhere and then it crashed the app... have you tried first making it work in dev mode npm run dev See changes at http://127.0.0.1:8080 |
I am reading those links. But in dev mode everything is fine. The issue comes when I upload the app to Heroku. And actually the issue seems to be with Helmet, because if I do this
I get undefined |
Actually I know what happened now I removed HtmlHeaderTags from the folder that component is
then you have to included in /components/App/App.js
So sorry, and thanks for your time |
I fixed that issue with Helmet, but Heroku not working yet due to the same issue with React hot loader. |
hmm maybe I need to remove something I check tomorrow to remove react-hot loader in case of production distribution. https://github.com/darul75/web-react/blob/master/conf/webpack-config.js#L126 to get (or similar) { test: /\.(jsx?)$/, loaders: ['react-hot', 'babel?presets[]=react,presets[]=es2015,plugins[]=transform-decorators-legacy,plugins[]=transform-class-properties'], exclude: /node_modules/ } become { test: /\.(jsx?)$/, loaders: ['babel?presets[]=react,presets[]=es2015,plugins[]=transform-decorators-legacy,plugins[]=transform-class-properties'], exclude: /node_modules/ } based on 'prod' variable https://github.com/darul75/web-react/blob/master/conf/webpack-config.js#L46 if (prod).... I keep you in touch, weird as for me no problem to push on heroku |
Hi, can you send me a link to your code, or content of your package.json for example, I can not reproduce issue |
Hey, do not worry, I just fix it, the issue is in the package.json, react-hot-loader was in DevDependencies instead of Dependencies. |
HMR] Update applied.
It appears that React Hot Loader isn't configured correctly. If you're using NPM, make sure your dependencies don't drag duplicate React distributions into their node_modules and that require("react") corresponds to the React instance you render your app with. If you're using a precompiled version of React, see https://github.com/gaearon/react-hot-loader/tree/master/docs#usage-with-external-react for integration instructions.
The text was updated successfully, but these errors were encountered: