-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Npm Run Dev: Modify Vue Webpack Template Dev Server to use --watch-poll #432
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
Comments
Watching is The job of webpack-dev-middleware. You can see the poll option in the example config here: https://github.com/webpack/webpack-dev-middleware/blob/master/README.md |
@necevil does that answer your question? |
@LinusBorg Yep!
As it turned out I was able to make it work WITHOUT the above, but when I went to deploy my same configuration to some of our other team members they required the above polling modification to make the dockerized webpack-dev-middleware server aware of changes to files on the local host / docker volume. Without the above wdm would not notice the changes and trigger a new build, with the above added everything worked as intended. For those who are confused as to exactly where to add that snippet, it needs to go inside of the dev-server.js file which is located inside of the build directory within this template. The code block you are looking to modify should end up looking like this (around line 22-24ish):
Thanks Linus! |
Thanks @necevil - your comment seems to be the only place on the entire web that concisely explains how to make this work. 👍 |
Stoked to hear it @matthewpennell Hoping took notes to document for the team, hoping to blog it eventually but this is pretty much the nuts and bolts of the tricky portion. |
I ignore running npm run dev in vagrant ssh. Just use normal terminal |
thanks @necevil |
Thank all, work for me. |
@necevil Thanks!! That's worked for me too! |
Thx. |
Currently running
If loading your app is taking too long on the browser, set it to a higher number like 1000, 1500 |
The webpack.mix file is a hell of code where to place this code
|
I am running the webpack portion of this template stack inside of a docker container I created, which also contains the vue CLI (https://hub.docker.com/r/ncevl/webpack-vue/). However, hot-reload does not work after moving from the webpack-simple template to this one.
Everything was working using the Webpack-Simple template which you can see over here: https://github.com/vuejs-templates/webpack-simple
I was able to get the simple template running (with hot-reload working as intended) with the following webpack-development-server launch command:
webpack-dev-server --hot --inline --progress --host 0.0.0.0 --watch-poll
The full version of the webpack template does not appear to use a webpack-dev-server launch command and instead appears to use additional middleware as referenced in build/dev-server.js (https://github.com/vuejs-templates/webpack/blob/master/template/build/dev-server.js) and the webpack dev config.
Since the
--watch-poll
was the key to getting the WDS hot-reload functionality to work within a docker container in the last project, my thinking is that I need to do something similar with the webpack-hot-middleware but I dont see anything in their docs (over here: https://github.com/glenjamin/webpack-hot-middleware) that talks about changing to a polling based approach.I am wondering if anyone has run into anything similar or has any ideas. I guess my alternative would be roll back to a more basic webpack config and rebuild that portion of things to use the traditional webpack-dev-server.
The text was updated successfully, but these errors were encountered: