2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SvelteをVercelでデプロイする

Posted at

前回作ったTodoアプリをVercelでデプロイしてみます。

公式

デプロイ設定

$ bun install -d @sveltejs/adapter-vercel
svelte.config.js
-import adapter from '@sveltejs/adapter-auto';
+import adapter from '@sveltejs/adapter-vercel';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  // Consult https://svelte.dev/docs/kit/integrations
  // for more information about preprocessors
  preprocess: vitePreprocess(),

  kit: {
    // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
    // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
    // See https://svelte.dev/docs/kit/adapters for more information about adapters.
    adapter: adapter()
  }
};

export default config;

ローカルで動作確認

$ bun run build
$ bun run preview

ScreenShot 2024-12-30 10.30.14.png

エラーが出てないことを確認しておきます。

プロジェクトの作成

ScreenShot 2024-12-30 10.11.06.png

Framework Presetでは SvelteKit (v1) を選択します。

ScreenShot 2024-12-30 10.11.39.png

  • Root Directory: ./
  • Build Command: bun run build
  • Output Directory: static
  • Install Command: bun install

今回は Envinronment Variables で指定したいものないのでスキップ

ScreenShot 2024-12-30 10.14.09.png

デプロイします。

ScreenShot 2024-12-30 10.59.51.png

ScreenShot 2024-12-30 11.00.04.png

デプロイ成功しました。

デプロイしたページにアクセスします。

ScreenShot 2024-12-30 11.03.45.png

問題なくデプロイできたのでokです。
めちゃくちゃ簡単でした✌️

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?