Giter Site home page Giter Site logo

Comments (14)

aeneasr avatar aeneasr commented on May 2, 2024 1

@pohy try set NODE_ENV=development&& node webpack/server.js (replace the whitespace)

from webpack-hot-middleware.

aeneasr avatar aeneasr commented on May 2, 2024

I've checked out https://github.com/gaearon/react-transform-boilerplate which works fine on my machine, so it should not be connected to #36

from webpack-hot-middleware.

aeneasr avatar aeneasr commented on May 2, 2024

This is a strange one. When running:

> node server

hot reloading works fine. But when running:

>set NODE_ENV=randomString && node server

hot reloading does not work.

Here are some working vs some not working examples. Each code box is a new shell.

working

> node server

working

> set NODE_ENV=development
> node server

not working

> set NODE_ENV=development && node server

not working

> set NODE_ENV=development && node server
[ctrl+c]
> node server

I was able to reproduce this issue with the react-transform-boilerplate:

# works
> node devServer.js
# does not work
> set NODE_ENV=foo && node devServer.js

from webpack-hot-middleware.

aeneasr avatar aeneasr commented on May 2, 2024

I'm still not sure if I'm overlooking some detail, because this is really weird. Here some more examples:

# works
> echo foo && node server
# works
> set FOO_BAR=foobar && node server

from webpack-hot-middleware.

srhise avatar srhise commented on May 2, 2024

I have this exact same issue after cloning and running the Shopping Cart example for Redux. Using Windows 10 / Node fully updated.

from webpack-hot-middleware.

arve0 avatar arve0 commented on May 2, 2024

Did you ever find the reason for this? I'm experiencing the same, using react-transform-boilerplate after adding redux (the boilerplate works nice in it's original form).

Trying to pin down the exact change that causes this, I also stumbled upon this error:

<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/rackt/react-redux/releases/tag/v2.0.0 for the migration instructions.

Might have something to do with it?

from webpack-hot-middleware.

arve0 avatar arve0 commented on May 2, 2024

Changing App from functional to extending React.Component, and moving setInterval inside App solved hot reloading for me.

from webpack-hot-middleware.

glenjamin avatar glenjamin commented on May 2, 2024

Can this be closed? Is it still an issue?

from webpack-hot-middleware.

pohy avatar pohy commented on May 2, 2024

Yes, this is still an issue, as @arekkas pointed out:
not working (executed using npm scripts):
set NODE_ENV=development && node webpack/server.js
working (from command line):

> set NODE_ENV=development
> node webpack/server.js

from webpack-hot-middleware.

pohy avatar pohy commented on May 2, 2024

@arekkas Wow, that solved the issue, many thanks.

from webpack-hot-middleware.

aeneasr avatar aeneasr commented on May 2, 2024

Yeah it seems like windows adds the white space to the environment variable which causes this issue.

from webpack-hot-middleware.

rossipedia avatar rossipedia commented on May 2, 2024

Windows environment variables created with the SET command are persistent as long as cmd.exe is still running.

Also, Windows uses a single & to represent boolean and, instead of the double && that you're used to on OSX/*nix.

As you've discovered, the Windows' SET command is sensitive to whitespace. Another solution is to use quotes.

So, this:

set NODE_ENV=development && node webpack/server.js

should actually be this:

set NODE_ENV="development" & node webpack/server.js

or better yet:

set NODE_ENV="development"
node webpack/server.js
set NODE_ENV=

That last line unsets the NODE_ENV variable.

from webpack-hot-middleware.

rossipedia avatar rossipedia commented on May 2, 2024

Another popular solution is to use the cross-env module, which allows you to set environment variables for a process in the same way across operating systems:

npm i --save-dev cross-env

node_modules/.bin/cross-env NODE_ENV=development node webpack/server.js

This will work the same on OSX, Windows, and Linux

from webpack-hot-middleware.

aeneasr avatar aeneasr commented on May 2, 2024

We also had great experiences with cross-env, definately recomment it

from webpack-hot-middleware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.