如何在子目录中托管Svelte应用程序? [英] How can I host a Svelte app in a subdirectory?
问题描述
如何在域的子目录中托管导出的Svelte项目?想象一下example.com是我的域名,我如何让 src \ routes \ index.svelte 对应于 https://example.com/subdir/ ?
How can I host an exported Svelte project in a subdirectory on my domain? Imagine that example.com is my domain, how can I have src\routes\index.svelte correspond to https://example.com/subdir/?
当我将Svelte导出文件上载到Web服务器的此子目录时,它从控制台读取它找不到
When I upload the Svelte export to this subdirectory of the web server, it reads from the console that it cannot find https://example.com/service-worker.js among other files, which is true, because it's in the /subdir folder. But where can I set the base URL?
推荐答案
You can set it in src/server.js
: https://sapper.svelte.dev/docs#Base_URLs
如果您使用的是sapper export
,请记住使用--basepath
选项.
Remember to use the --basepath
option if you're using sapper export
.
这篇关于如何在子目录中托管Svelte应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!