Comments (14)
@pohy try set NODE_ENV=development&& node webpack/server.js
(replace the whitespace)
from webpack-hot-middleware.
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.
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.
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.
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.
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.
Changing App
from functional to extending React.Component
, and moving setInterval
inside App
solved hot reloading for me.
from webpack-hot-middleware.
Can this be closed? Is it still an issue?
from webpack-hot-middleware.
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.
@arekkas Wow, that solved the issue, many thanks.
from webpack-hot-middleware.
Yeah it seems like windows adds the white space to the environment variable which causes this issue.
from webpack-hot-middleware.
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.
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.
We also had great experiences with cross-env, definately recomment it
from webpack-hot-middleware.
Related Issues (20)
- TypeError: cb is not a function HOT 1
- error TS2339: Property 'compilers' does not exist on type 'Compiler'. HOT 1
- Which package to use on a Deno server? HOT 1
- `webpack-hot-middleware/client?reload=true` is no longer working with webpack 5. HOT 36
- not work on webpack5 HOT 7
- Overlay is not working with Webpack 5 HOT 4
- Ignored an update to unaccepted module - No automatic page reloading with recent versions of webpack and react packages HOT 3
- Types are broken with Webpack 5 HOT 3
- `module.hot` is required ?
- enable use of other backends besides express
- when updating the example everything will break please update HOT 4
- ReDoS Vulnerability HOT 2
- Replace deprecated querystring component with builtin URLSearchParams API HOT 8
- Overlay is invalid in webpack5. Haven't you solved it yet? How long do you plan to publish it to the master? I hope you can reply
- Hot Updates not being handled by server HOT 2
- Opening 5+ tabs causes Express to hang indefinitely HOT 2
- webpack-hot-server-middleware on demand loading bug
- webpackv5 webpack-hot-server-middleware Compatibility problems HOT 1
- A Chrome specific issue, where requests are getting blocked after a handful of link clicks HOT 3
- Webpack 5: incorrect compilation error text output starting with "undefined undefined" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-hot-middleware.