A
A
anton8782019-04-24 19:48:15
Angular
anton878, 2019-04-24 19:48:15

Why is there no page auto-refresh in Angular + electron?

Let me just say that I am a newbie.
When installing pure angular, after changing the html file, the site page is automatically updated.
I wanted to combine with the electron.
Installed according to the instructions https://progtask.ru/angular-electron/
Auto-refresh of the page in the electron application was gone.
Googled a lot. Tried different options. Did not help.. How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Pikat, 2019-04-29
@PavelPikat

If you did everything according to the instructions and in package.json you only have the "build" script, then you should not wait for any update. The update will be if your bundler (Webpack, for example) starts to "look" for changes, webpack --watch
Or try this (corrected from your project, you may need to install webpack-dev-server and change something):

"scripts": {
    "ng": "ng",
    "lint": "ng lint",
    "start": "npm-run-all --parallel webpack:watch electron:serve",
    "webpack:watch": "webpack --watch",
    "start:web": "webpack-dev-server --content-base . --port 4200 --inline",
    "build:electron:main": "tsc main.ts --outDir dist && cpx package.json dist && cpx resources/app/**/* dist && cd dist && npm install --prod && cd ..",
    "build": "webpack --display-error-details && npm run build:electron:main",
    "build:prod": "cross-env NODE_ENV=production npm run build",
    "electron:serve": "npm run build:electron:main && electron ./dist --serve",
    "electron:dev": "npm run build && electron ./dist"
  },

npm run start will run everything and start updating pages

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question