Next.js Installation

Install the CodeSee package in your JavaScript or TypeScript app

In the terminal, run the install command for your package manager:

=== "npm"

```shell
npm install --save-dev @codesee/tracker@latest @codesee/babel-plugin-instrument@latest
```

=== "yarn"

```shell
yarn add --dev @codesee/tracker@latest @codesee/babel-plugin-instrument@latest
```

Configure your project

You need to add CodeSee to your .babelrc or babel.config.js.

You either need to follow option A or option B. Check the root of your Next.js app for a .babelrc or babel.config.js.

Option A: If you don't have a Babel config

If you don't have one, create a new babel.config.js file in the root of your Next.js app.

module.exports = {
  "presets": ["next/babel"],
  "plugins": [],
  "env": {
    "development": {
      "plugins": [["@codesee/instrument", {"hosted": true}]]
    }
  }
}

Option B: Add CodeSee to your existing Babel config

Open your .babelrc or babel.config.js file, and add the codesee plugin under env -> development. For example, if you started with the default .babelrc for Next.js:

{
  "presets": ["next/babel"],
  "plugins": [],
}

then you can add CodeSee with:

{
  "presets": ["next/babel"],
  "plugins": [],
  "env": {
    "development": {
      "plugins": [["@codesee/instrument", {"hosted": true}]]
    }
  }
}

Optional: configuration for large or high data applications

verbose: boolean

By default, CodeSee instruments your code in order to record the data value of every expression. This always results in the application running slower while recording, and in rare circumstances, it can cause a noticeable slow down even when not recording. If this slowdown is happening in your application, you can configure CodeSee to use verbose: false (or terse) mode. CodeSee will instrument your code less and capture less data (just the inputs and outputs of functions), but continue to provide the same tracing, side effects, and visualizations as always.

  • Verbose mode (default): gets all of the runtime data but in some applications or recordings can cause a noticeable slowdown.
  • Terse mode: captures less runtime data, but your recordings will be more performant. If you have a high data application, or are noticing slowdown, we recommend you try setting verbose: false.
"plugins": [
   ["@codesee/instrument", { "hosted": true, "verbose": false }],
   /* ... other dev plugins ... */
]

!!! note
This setting affects all developers working on the application. It requires a clean build.

Rebuild and run your app locally

Rebuild your app, wait a few seconds, and you should see the CodeSee button towards the top right of your screen. Congrats, you're ready to start using CodeSee!