StoryBook Installation

This configuration uses a custom Storybook preset, which should be compatible with Storybook version 4.0.0 or newer.

Install the CodeSee package in your JavaScript or TypeScript app

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

=== "npm"

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

=== "yarn"

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

Create codesee-storybook-preset.js in your .storybook directory

Copy the following into a new file called codesee-storybook-preset.js inside your .storybook directory:

module.exports = {
  babel: async (config, options) => {
    if (options.configType === "DEVELOPMENT") {
      const plugins = config.plugins = config.plugins || [];
      plugins.push(['@codesee/instrument', { hosted: true }]);
    return config;

Add the preset to addons in main.js

You should have a main.js in your .storybook directory.

You need to add the following to the addons section of main.js:


If you haven't already, you may need to require the path module:

const path = require('path');

An example of a final main.js would look something like the following:

const path = require('path');

module.exports = {
  "stories": [
  "addons": [

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!