LoginSignup
0
0

More than 1 year has passed since last update.

next.jsの静的ファイルの配信

Posted at

このエラーが表示された時の対処法

cannot find module '../public' or its corresponding type declarations.

Next.js は、ルートディレクトリの public フォルダ下で、画像などの静的ファイルを配信できます。public 内のファイルは、ベース URL(/)から始まるコードで参照できます。
例えば、 public/me.png に画像を追加した場合、次のコードで画像にアクセスします:

import Image from 'next/image'

function Avatar() {
  return <Image src="/me.png" alt="me" width="64" height="64" />
}

export default Avatar

https://nextjs-ja-translation-docs.vercel.app/docs/basic-features/static-file-serving

0
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
0
0