wails-angular-template icon indicating copy to clipboard operation
wails-angular-template copied to clipboard

Hot Reload doesn't work

Open DonTomato opened this issue 3 years ago • 4 comments

I am working with Wails CLI v2.0.0-beta.14. It works, but there is a problem - if I change something on frontend side it stops working with the following error: image The vendor.js file is really absence. If I run npm run build this file doesn't exist as well, but index.html doesn't contain reference to it. But as I change something, for example app.component.html it appeared in index.html:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Frontend</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.css"></head>
<body>
  <app-root></app-root>
<script src="runtime.js" defer></script><script src="polyfills.js" defer></script><script src="vendor.js" defer></script><script src="main.js" defer></script></body>
</html>

But the dist folder doesn't contain it. In case of npm run watch there are both vendor.js file and reference in the index.html to it. But for some unclear reason wails dev produces dist without vendor.js but index.html which contains reference to it. The current workaround is, and that's all I could find: run npm run watch manually in the additional terminal. Then I can modify frontend and the changes will be reflected constantly in the app. Is it possible to fix it somehow? I'm not sure isn't it an issue of your template or this is a wails issue. I work in the windows environment, but don't know does it matter or not.

DonTomato avatar Oct 24 '21 19:10 DonTomato

I noticed also that something wrong is happening in the following place: image Initially dist folder contains vendor and whole set of "map" files. In that moment the content of the dist folder is changing the following way: image But index.html remains to be old. It seems that initialization of frontend finished before this moment. That's why it runs initially. But as soon as I change something, it breaks down.

DonTomato avatar Oct 24 '21 19:10 DonTomato

image

DonTomato avatar Oct 24 '21 19:10 DonTomato

This is due to a bug in Wails beta.14 (https://github.com/wailsapp/wails/issues/889). Until it's fixed, to get proper Hot Reloading, remove the frontend:build command in wails.json before running wails dev. Just be sure to add it back, when building for prod with wails build.

TAINCER avatar Oct 24 '21 20:10 TAINCER

There are new errors without frontend:build command with beta.15: image

DonTomato avatar Oct 27 '21 18:10 DonTomato