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

【Next.js】VSCodeでデバッグする方法

Posted at

Next.jsでデバッグモードを設定する方法を解説します。

1.プロジェクトのルートに.vscode/launch.jsonという名前のファイルを作成

プロジェクトのルートに.vscode/launch.jsonという名前のファイルを新規作成します。
image.png

.vscodeフォルダの中にlaunch.jsonを作成します。
image.png

2.package.jsonを更新

scriptsの箇所を2点追加・修正します。

1点目:debugを追加

scriptsdebugを追加します。

package.json
//(略)
"debug": "NODE_OPTIONS='--inspect' next dev"
//(略)

2点目:devを修正

scriptsdevを修正します。

package.json
【修正前】
"dev": "next dev",

【修正後】
"dev": "NODE_OPTIONS='--inspect' next dev",

3.VSCodeのデバッグモードアイコン「image.png」をクリック

デバッグモードのアイコン「image.png」をクリックします。

4.デバッグモードを「image.png」に設定

下記の箇所から「image.png」を選択します。
image.png

5.デバッグボタン「image.png」をクリックしてデバッグ開始

デバッグボタン「image.png」をクリックすればデバッグが開始されます。

image.png

6.デバッグの停止は「Shift + F5」を押す

デバッグの停止は、「Shift + F5」で停止できます。

サイト

Next.jsでデバッグツールを使用する方法

win-node-env

WindowsでNext.jsの環境構築をするときのTips

Next.js を VisualStudioCode(VSCode)を使ってデバッグする方法

サーバサイドもクライアントも簡単デバッグ VS Codeでブレークポイント編

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?