Electron app isn't finding CSS/JS included in package

前端 未结 3 1971
自闭症患者
自闭症患者 2021-01-05 03:41

I have an HTML5 web app that I\'m packaging up via Electron. I\'m packaging via gulp-electron.

The issue I\'m having is that when the app is built and I run it, none

3条回答
  •  一向
    一向 (楼主)
    2021-01-05 04:41

    Electron approaches files through file:// protocol, so any base hrefs should start with '.'

    To make it work, in index.html (in case '/' is your base href) change

     
    

    into

    
    

    ..and the path errors will disappear.

    So with electron apps we always need to compile the angular dist using a base href starting with '.', when / is your base, compile as

    ng buid --prod --base-href ./
    

提交回复
热议问题