Skip to content

Configuring CodeSee with Nuxt.js

Install the CodeSee package in your JavaScript or TypeScript app

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

npm install --save-dev @codesee/[email protected] @codesee/[email protected]
yarn add --dev @codesee/[email protected] @codesee/[email protected]

Configure your project

You need to edit your nuxt.config.js to make sure the codesee Babel plugin is included when in development mode.

Store your config in a variable named config

That is, change from:

Before (in your nuxt.config.js)

export default {
  // ... your config goes here
}

After (in your nuxt.config.js)

const config = {
  // ... your config goes here
}

export default config;

Edit your config to ensure CodeSee runs when your app is run in development mode

The new code goes just before the export default config; line.

In your nuxt.config.js:

// Use CodeSee instrumentation in development mode
if (process.env.NODE_ENV !== 'production') {
  const babel = config.build.babel = config.build.babel || {};
  const plugins = babel.plugins = babel.plugins || [];
  plugins.push(['@codesee/instrument', { hosted: true }]);

  const render = config.render = config.render || {};
  const bundleRenderer = render.bundleRenderer = render.bundleRenderer || {};
  bundleRenderer.runInNewContext = false;
}

export default config;

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!