Skip to content
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

Polling not working in webpack-dev-server #194

Closed
maspwr opened this issue Jun 8, 2015 · 4 comments
Closed

Polling not working in webpack-dev-server #194

maspwr opened this issue Jun 8, 2015 · 4 comments

Comments

@maspwr
Copy link

maspwr commented Jun 8, 2015

I'm trying to set up the webpack-dev-server to watch for changes using the polling mechanism. Polling in general works if I do webpack --watch --watch-polling as mentioned in webpack/webpack#125 (comment), however I cannot get it to work in webpack-dev-server. Following the docs, I'm trying to pass the following option:

watchOptions: {
  poll: true
}
@maspwr maspwr changed the title Polling not working Polling not working in webpack-dev-server Jun 8, 2015
@cogwire
Copy link

cogwire commented Jun 11, 2015

I can confirm that this is an issue with the release (v1.9.0) and commit 8e8f540. Appears to be an issue with socket.io as the exception is on line 23 of socket.io/lib/transport/polling.js
https://github.com/Automattic/engine.io-client/blob/d0e8643d050196ce29d88438d129230817f89c85/lib/transports/polling.js

The webpack output is as follows, and causes an exception (object is not a function):
var xhr = new XMLHttpRequest({ xdomain: false });

Executing the following on the console works as expected:
var xhr = new XMLHttpRequest.XMLHttpRequest({ xdomain: false });

Comparing the result of var XMLHttpRequest = webpack_require(/*! xmlhttprequest */ 19);

Not working:
function XMLHttpRequest()

Working:
function module.exports(opts)

Checking my make-webpack-config.js, I found the problem:

var externals = [{
xmlhttprequest: '{XMLHttpRequest:XMLHttpRequest}'
}];

Removing xmlhttprequest from this array solved my problem. I am pretty sure I put it in there to resolve this issue: #66

@sokra Keep up the great work!

@Andrew8xx8
Copy link

@maspwr as written here http://webpack.github.io/docs/webpack-dev-server.html

you must put these lines:

 watchOptions: {
    aggregateTimeout: 300,
    poll: 1000
  },

into WebpackDevServer constructor.

This works fine for me.

@janraasch
Copy link

@Andrew8xx8 works like a charme with my vagrant setup. Thank you.

@maspwr
Copy link
Author

maspwr commented Apr 5, 2016

I see that others aren't having this issue. I'll retest when I need to use that functionality again and reopen if I can reproduce the issue. Thanks.

@maspwr maspwr closed this as completed Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants