1
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?

More than 1 year has passed since last update.

AppRouterなNext.jsで作った静的なコンテンツを出力する

1
Last updated at Posted at 2024-05-07

背景

近年、Github PagesやCloudflare Pagesなどの、
静的なコンテンツを無料で公開できるサービスが多くなってきことに加え、
AppRouterなNext.jsに関する書籍が手元にあるので、
まず静的なコンテンツを出力してみたい。

やること

まず、Next.jsを取ってきます。

nox create-next-app

きかれたことに答えます。ここでは素直にAppRouterを選びます。

次に、next.config.jsoutput:'export'を加えて全部静的にします。

/** @type {import('next').NextConfig} */
const nextConfig={
	output:'export',
};

export default nextConfig;

あとはお好みのSPAを作ってnpm run buildします。
するとoutというフォルダができてビルド成果物が出力されます。

1
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
1
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?