White Screen on Fresh New Angular 8/Electron 5 App

前端 未结 2 897
死守一世寂寞
死守一世寂寞 2021-02-20 05:48

I am building and running an Angular 8/Electron 5 desktop app. After what I believe to be proper setup, running the app displays a blank white screen.

Using:
Electr

2条回答
  •  难免孤独
    2021-02-20 06:10

    The error seems to be caused to the type="module" attributes on the scripts elements, at least this is the main difference I found.

    To fix it there is another option in Electron context which would be to generate only the es2015 file (resulting in smaller and potentially faster script).

    Based on the following you can achieve that by setting a Browserslist with browsers that all support es2015. Angular-cli 8 - Is it possible to build only on es2015?

    In electron context the best is to set the browser list to your electron version:

     "browserslist": [
        "Electron 5.0.1"
      ],
    

    This worked for me and I guess this may be a bit better than downgrading to es5. Well at least if electron is the only target, it may be safer to downgrade to es5 if you plan to release your app on a web version also (or configure different builds for electron and web).

提交回复
热议问题