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 5 years have passed since last update.

[備忘録]Next.jsプロジェクト導入方法

Last updated at Posted at 2019-12-24

個人の備忘録です。

Next.jsの導入方法

前提条件

Node.jsは導入済みとする。

方法

プロジェクトフォルダにpackage.jsonファイルを作成する。
内容は以下の通り

"package.json"
{
   "scripts": {
      "dev": "next",
      "build": "next build",
      "start": "next start",
      "export": "next export"
  }
}

フォルダ内で以下のコマンドを実行する。

npm install --save next react react-dom

ページ作成

プロジェクトフォルダにpagesフォルダを作成する.
このフォルダがWebページを配置しておくための場所になる。

このフォルダ内にindex.jsファイルを作成する。
内容は下記の通り

index.js
export default () =>
  <div>
    <h1>Next.js</h1>
    <p>新しいプロジェクトです</p>
  </div>

プロジェクトの実行

プロジェクトフォルダ内で下記のコマンドを実行

npm run dev

ブラウザで確認する。
スクリーンショット 2019-12-24 20.13.23.png

以上

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?