使用AWS放大的静态苗条应用程序

发布于 2025-02-11 20:01:19 字数 112 浏览 1 评论 0原文

我正在尝试将我的Svelte应用程序部署在AWS Amplify上,我按提交,放大构建并验证应用程序,但是如果我访问应用程序URL,那只是一个空白页,这可能是一个适配器问题?我尝试了节点和静态的节点,但没有运气

I'm trying to deploy my Svelte app on AWS Amplify, I push the commits, Amplify builds and verifies the app, but then if I visit the app URL it's just a blank page, it might be an adapter problem? I tried the node.js and static ones but no luck

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝礼 2025-02-18 20:01:19

如果您想部署Sveltekit应用程序来放大AWS。您需要使用@sveltejs/Adapter static,因为它将通过静态CDN为您的应用提供服务。

更改适配器后,请确保在svelte.config.js

// svelte.config.js
import adapter from '@sveltejs/adapter-static';

export default {
  kit: {
    adapter: adapter({
      fallback: 'index.html'
    })
  }
};

If you want to deploy a Sveltekit application to AWS Amplify. You need to use the @sveltejs/adapter-static, since it will serve your app via a static CDN.

Once you change the adapter, make sure to add a fallback in svelte.config.js:

// svelte.config.js
import adapter from '@sveltejs/adapter-static';

export default {
  kit: {
    adapter: adapter({
      fallback: 'index.html'
    })
  }
};
樱娆 2025-02-18 20:01:19

最后,这解决了问题:

svelte.config.js

import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter(),
        prerender: {
            default: true
        }
    }
};

export default config;

In the end, this solved the problem:

svelte.config.js

import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter(),
        prerender: {
            default: true
        }
    }
};

export default config;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文