Webpack dev server reload doesn't work on virtual box

蹲街弑〆低调 提交于 2019-12-02 23:38:09
Maxim Schepelin

I've solved my problem with vagrant rsync-auto https://docs.vagrantup.com/v2/cli/rsync-auto.html

I'd added the line config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync_auto: true, rsync_exclude: ".git/" to my Vagrantfile, and run vagrant rsync-auto under a separate tab.

Mnebuerquo

This is answered under another question: https://stackoverflow.com/a/34937378/5114

If you add the --watch-poll option it changes the way webpack looks for file changes.

webpack-dev-server --watch-poll --port 8080 --devtool eval --progress --colors --hot --content-base dist

This makes webpack poll for changes to the files every N milliseconds. Polling works in the Vagrant shared directories when the normal method doesn't because it doesn't look for mtime or other filesystem attributes, just reads the files on an interval. It's slower and uses more cpu/memory, so don't use polling unless you have to.

https://webpack.github.io/docs/cli.html#watch

the first thing you need to see is if in the console where you're running the server, the recompiled process is happening or not. If' not the answer is in the SyncFolder line that @maxim-schepelin said above. If is recompiling and the web page is not reloading maybe the webPack solution.

Edit

Another reason for the folder sync not working the righ way could be this https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!