vuepress: Hot reload not working
- I confirm that this is an issue rather than a question.
Bug report
Steps to reproduce
$ yarn add vuepress --dev
$ mkdir docs
$ youch docs/index.md
$ yarn vuepress dev docs
success [08:52:12] Build 1d01b9 finished in 172 ms! ( http://localhost:8080/ )
What is expected?
Vuepress CLI detects file changes and rebuilds.
What is actually happening?
Vuepress CLI doesn’t detect file changes. I have to run vuepress dev docs again to build codes.
Other relevant information
- Output of
npx vuepress infoin my VuePress project:
% npx vuepress info
Environment Info:
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Binaries:
Node: 14.2.0 - ~/.nodebrew/current/bin/node
Yarn: 1.22.4 - ~/.nodebrew/current/bin/yarn
npm: 6.14.4 - ~/.nodebrew/current/bin/npm
Browsers:
Chrome: Not Found
Edge: Not Found
Firefox: Not Found
Safari: Not Found
npmPackages:
@vuepress/core: 1.5.0
@vuepress/theme-default: 1.5.0
vuepress: ^1.5.0 => 1.5.0
npmGlobalPackages:
vuepress: Not Found
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 55
- Comments: 62 (9 by maintainers)
Commits related to this issue
- lock webpack version. See <https://github.com/vuejs/vuepress/issues/2392>. — committed to enqueuezero/site by soasme 4 years ago
- Add temporary watchpack fix Fixes hot reloading, details here: https://github.com/vuejs/vuepress/issues/2392#issuecomment-633399465 — committed to dennisreimann/btcpayserver-doc by dennisreimann 4 years ago
- fix: fix HMR Fix #2392 Upgrades http-proxy — committed to vuejs/vuepress by posva 4 years ago
- Fix hmr ( https://github.com/vuejs/vuepress/issues/2392 ) — committed to appsocially/upil-site by wallslide 4 years ago
- fix($core): watch file changes event close #2392 — committed to vuejs/vuepress by billyyyyy3320 4 years ago
- fix (#2392): hmr issue and watch for chokidar v3 (#2436) * fix: watch for chokidar v3 * chore: remove comments — committed to vuejs/vuepress by pikax 4 years ago
- fix (#2392): hmr issue and watch for chokidar v3 (#2436) * fix: watch for chokidar v3 * chore: remove comments — committed to larionov/vuepress by pikax 4 years ago
- 🐛 Temporary watchpack fix https://github.com/vuejs/vuepress/issues/2392#issuecomment-633399465 — committed to dennisreimann/hey-bitcoin.de by dennisreimann 4 years ago
“watchpack”: “1.6.1”
I noticed that the webpack hot update plugin
watchpackis now1.7.2I compared the previous project and found it was1.6.1So I tried to install this version It’s ready for hot updateyarninstalls"watchpack": "^1.6.1"separately inwebpackThis automatically correlates to1.7.2So it only works innpmmodeyarnsolution is answered belowIn a project created by
@vue/cli 4.3.1, thewatchpackis1.7.2, but it can still trigger hot updates Confused!Thanks to @SCWR I got it working by downgrading watchpack to 1.6.1 Added
resolutionssection topackage.jsonand ranyarn installHope this helps to anyone struggling with the same problem
Try
npm vuepress dev docs --temp .temp/yarn vuepress dev docs --temp .tempinstead. See if it works for you.If yes you could write this into package.json:
"dev": "vuepress dev docs --temp .temp"Thanks for filing the issue @reiwa! Going to take a look into this as a high priority. Appreciate it!
You can update the configuration in package.json as follows
then
finally
hot reloading is ok
Yes, this way is currently the most effective,and wait for the latest version to deal with this problem.
I used the
vuepress v1.40, andnode v14.2.0, hot reload working.And use
nodemonto automate the restart on every file change. Thanks @pepsifan .Alright! Hopefully this is now fixed thanks to @pikax and @sodatea for their assistance.
For those on v1.5.0, please make sure to upgrade to v1.5.1 and then you should be good.
I’ll close the issue for now, but please let us know if it’s still broken for you!
Hello,
For those who still want to use npm (resolutions only works with yarn by default). You can use this package : https://github.com/rogeriochaves/npm-force-resolutions.
version 1.5.1
Updating .md files. Hot reload OK.
Updating config.js. Hot reload Not Working.
Updating YAML Frontmatter in .md files. Hot reload Not working.
This worked for me using 1.7.1 and npm, Windows 10. I don’t know why or what it does.
I tried everything in the above. But its not working for me too in windows.
The terminal log updates and says build is finished. But its not updating in server. Even refresh not working. had to terminate the job and run
vuepress devagain to see the changes.Please provide me a fix.
Vuepress v1.4.0, hot reloading not working with node v14.3.0. Using nodemon isnt working either
Edit: For some reason updating the config.js does trigger the hot reload, but nothing happens with the other files
I have the same situation. After testing node v10.15.3 hot not working. Node v12.14.0 hot working
Thank you. I confirm the issue is solved for me!
I had the same problems a few days ago. I use a workaround to restart the server on file change. See here.
webpack downgraded to 1.6.1, but still not working.
config.jsNOT works@thominal this works for me
Although it works, I have to refresh my browser for it to work
me too
@surjithctly Got it. I would definitely add your comments and threads to #2437 then. Thank you!
yeah this solved my issue