简体   繁体   English

Hot Reload 在 Electron 带有 svelte-routing 的 Svelte 中显示空白屏幕

[英]Hot Reload shows blank screen in Electron Svelte with svelte-routing

I am working on an Electron.js application, utilizing Svelte as my frontend framework.我正在开发一个 Electron.js 应用程序,使用 Svelte 作为我的前端框架。

I'm using hot reload with chikidar, but every time I reload it shows a white blank screen, and I get an error in the devtools: Not allowed to load local resource: file:///我正在使用 chikidar 的热重载,但每次重载时都会显示一个白色的空白屏幕,并且在 devtools 中出现错误: Not allowed to load local resource: file:///

I think this is because I use the svelte-routing package, and do something wrong with it.我认为这是因为我使用了 svelte-routing package,并且做错了什么。 When I first start the app, the window location is: file:///path/to/project/public/index.html , but after the first svelte-routing link is used, it changes to: file:/// .当我第一次启动应用程序时, window 位置是: file:///path/to/project/public/index.html ,但在使用第一个 svelte-routing 链接后,它变为: file:///

What am I doing wrong?我究竟做错了什么?

Because it's an electron app, url doesn't really matter, I store the current page name in a Svelte store, and I have an if-else block for choosing which page to display因为它是一个 electron 应用程序,所以 url 并不重要,我将当前页面名称存储在 Svelte 商店中,并且我有一个 if-else 块用于选择要显示的页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM