A webpack.config.js like this (mostly pulled from the docs)
var path = require("path");
module.exports = {
entry: {
app: ["./app/main.js"]
},
output: {
path: path.resolve(__dirname, "build"),
publicPath: "/assets/",
filename: "bundle.js"
},
devServer: {
proxy: {
'/': {
bypass: function(){
return '/test.html';
}
}
}
}
};
works fine with [email protected], but after updating to 1.15.0, I get
$ node_modules/.bin/webpack-dev-server --content-base build/
/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/node_modules/http-proxy-middleware/lib/config-factory.js:42
throw new Error('[HPM] Missing "target" option. Example: {target: "http://www.example.org"}');
^
Error: [HPM] Missing "target" option. Example: {target: "http://www.example.org"}
at Object.createConfig (/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/node_modules/http-proxy-middleware/lib/config-factory.js:42:15)
at new HttpProxyMiddleware (/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/node_modules/http-proxy-middleware/lib/index.js:16:45)
at module.exports (/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/node_modules/http-proxy-middleware/index.js:4:12)
at /Users/claytonwatts/dev/test/node_modules/webpack-dev-server/lib/Server.js:184:9
at Array.forEach (native)
at Object.Server.features.proxy (/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/lib/Server.js:171:19)
at Server.<anonymous> (/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/lib/Server.js:274:20)
at Array.forEach (native)
at new Server (/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/lib/Server.js:273:40)
at Object.<anonymous> (/Users/claytonwatts/dev/test/node_modules/webpack-dev-server/bin/webpack-dev-server.js:183:1)
Looks like this is the commit that adds http-proxy-middleware.
Confirmed this is also happening with 2.1.0-beta.0.
Could you try out if #563 works for you?
@SpaceK33z I'm now getting Fatal error: ENOENT: no such file or directory, open '<project>/node_modules/webpack-dev-server/client/live.bundle.js'
Not sure if that's from this or if I'm missing something else. I'll look a little deeper.
@cletusw, you need to run npm i && npm run prepublish in node_modules/webpack-dev-server. You could also copy/paste the contents of lib/Server.js in my PR (hacky hacky ;p).
@SpaceK33z That did it! Working fine now, thanks!
@cletusw, awesome! There are a few other small bugs in 1.15.0 that I want to fix first, but a release should happen soon.
Would it be possible to make a release now, just for this, since it's a P0? A lot of my team members keep hitting this issue and wasting time debugging until they find this ticket.
@SpaceK33z we had to fix out version to 1.14.1 (instead of ^1.14.1) for now, which is not a very good practice.
Do you think it would be possible to get a release sometime this week?
On top of that you might want to increase the test coverage here to reduce the risk of having another breaking change when upgrading the minor version.
Plenty of teams depend on your code mate; the price of fame (:
@txangel, I'm trying, but it is out of my hands (I have no permissions to publish to npm).
You're right in that there should be test coverage. It is very hard to test the dev-server thoroughly though, but there are some things we could test in isolation.
This has been released as part of 1.15.1.
Thank you!
Most helpful comment
Would it be possible to make a release now, just for this, since it's a P0? A lot of my team members keep hitting this issue and wasting time debugging until they find this ticket.