HMR not working as expected, reloads page instead
See original GitHub issueHot reloading components does not work at the moment (used to work just fine).
Describe the issue / bug.
When setting up a new project, hot reloading does not work. It used to work, I have a project from about 2 weeks ago (setup the same way) where it works just fine.
How can I reproduce this problem?
- Setup a new project:
vue init simulatedgreg/electron-vue my-project
- Install dependencies:
yarn
- Start:
yarn run dev
- Make a change in the HTML of a component, eg. change a text in
src/renderer/components/LandingPage/SystemInformation.vue
It will reload the whole app instead of hot-reloading the component.
Tell me about your development environment.
- Node version: 8.4.0
- NPM version: 5.5.1
- Yarn version: 1.0.1
- vue-cli version: 2.9.1
- Operating System: Darwin
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:12 (1 by maintainers)
Top Results From Across the Web
React + Webpack HMR is refreshing the page (not hot loading)
I just ran into this problem. A couple things: To help debug your particular issue, try enabling "Preserve log" (in Chrome dev tools)....
Read more >Hot Module Replacement - webpack
Hot Module Replacement (or HMR) is one of the most useful features offered by webpack. It allows all kinds of modules to be...
Read more >Problem: Live reloading isn't refreshing for Webpack 5
While in the terminal I noticed things updating, the page wouldn't automatically refresh. This turns out to be a small bug with how...
Read more >Set up React Hot Loader in 10 minutes - LogRocket Blog
HMR solves the problem of hot reloading, makes it easier to tweak ... the application does a live reload and the entire page...
Read more >HMR: See Changes without Reloading - SymfonyCasts
I'll move over and reload the page one time just to be safe. ... HMR isn't working for styles. ... Instead, it embeds...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After quite some time looking for a solution to this on my own project, I realized that the
webpack-dev-server
package actually has a built-in option for HMR (hot module reloading), so it may not be necessary to use the additionalwebpack-hot-middleware
from the current setup. Simply addinghot: true
to the Webpack Dev Server options made it all work as you’d expect—see below for example change.Open up .electron-vue/dev-runner.js and change from
to
There’s more details about the
hot
option here: https://webpack.js.org/configuration/dev-server/#devserverhot.NOTE: I’ve updated a few versions from this template’s default versions: Electron 6.0.4, Webpack 4.39.2, webpack-dev-server 3.8.0
I have the same issue. I found a workaround, In the file dev-client.js i commented line 8 (window.location.reload()) And HMR work as espected.