Closed Kaldrogh closed 7 years ago
Seems like the issue comes from the your process.env.NODE_ENV
environment variable. Do you always set it to production in your bash_profile
/ bashrc
or something?
Run node
in a terminal to open the prompt, and type process.env.NODE_ENV
. What does it return? It should be undefined, or even development
. Yours is probably production
because of some global configuration you might have.
just for security sake, can you post your 'isProd' function, or better yet the entire utils file?
Also try to clone the repo and checkout that branch, and c if u run into the same issue. If not, the problem is in your code.
If so, it's somewhere else.
When i check the value of NODE_ENV while nodemon and webpack dev server are not running, i get this result :
When i fire up both of them with yarn start and yarn web:wds, this is what i get :
Nodemon :
Webpack dev server :
process.env.NODE_ENV :
Console panel on Chrome :
Source panel :
utils.js :
// @flow
// eslint-disable-next-line import/prefer-default-export
export const isProd = process.env.NODE_ENV === 'production'
Like @goldylucks said, clone / download this folder, I think that's the chapter you're at :
https://github.com/verekia/js-stack-walkthrough/tree/master/05-redux-immutable-fetch
Run yarn
(don't forget that one), and yarn start
/ yarn dev:wds
in it. Do you get the same issue?
When i clone your repo, retrieve node modules and launch both nodemon and webpack dev server, it works perfectly. Altough, i can't figure out what was the problem with my setup... I've checked everything again and again... Pretty strange.
Thank you for your help both of you.
There has to be something that you missed, or a typo somewhere :) Copy paste all the files one by one until you find the difference! Closing the issue then.
Whatever i do, when i use yarn start and yarn dev:wds, the terminal is outputing "Server running on port 8000 (production)", webpack dev server is running fine on port 7000 but the files are served from localhost:8000/static/js/bundle.js and sourcemap doesn't seem to work. The app won't refresh by itslef because it is not listening on webpack dev server port.
I've checked multiple times my files and everything is correct.
Package.json
render-app.js
config.js
server/index.js
Thanks for helping me out.