4
3

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

[WSL] VS CodeでNext.jsのデバッグ

Last updated at Posted at 2020-01-10

#環境

  • WSL Ubuntu 16.04.6 LT
  • Next.js 9.1.7

#手順

Microsoft公式を参考にしますが、一部アレンジする必要があります。

それは以下の2点です。さくっと終わります。

  • launch.jsonを変更
  • VS CodeでRemote Debugを可能にする設定

以下、それぞれの手順です。

launch.jsonを変更

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Next: Chrome",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}",
      "skipFiles": [
        "${workspaceFolder}/node_modules/**/*.js",
        "<node_internals>/**/*.js"
      ]
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Next: Node",
      "runtimeExecutable": "${workspaceFolder}/node_modules/next/dist/bin/next",
      "port": 9229,
      "env": {
        "NODE_OPTIONS": "--inspect"
      },
      "skipFiles": [
        "${workspaceFolder}/node_modules/**/*.js",
        "<node_internals>/**/*.js"
      ]
    }
  ],
  "compounds": [
    {
      "name": "Next: Full",
      "configurations": [
        "Next: Node",
        "Next: Chrome"
      ]
    }
  ]
}

参考:https://spectrum.chat/next-js/general/debugging-in-vscode~f93e5e29-6cce-4b43-8fed-e5a6d302d04e

VS CodeでRemote Debugを可能にする設定

こちらの記事を参考に設定するだけです。

4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?