npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@autotracer/plugin-babel-react18

v1.0.0-alpha.54

Published

`@autotracer/plugin-babel-react18` is the AutoTracer build-time plugin for React apps that already compile through Babel, including Next.js, Create React App, and custom Babel-based setups. It injects `useReactTracer()` and hook labeling during compilatio

Downloads

319

Readme

@autotracer/plugin-babel-react18

Overview

@autotracer/plugin-babel-react18 is the AutoTracer build-time plugin for React apps that already compile through Babel, including Next.js, Create React App, and custom Babel-based setups. It injects useReactTracer() and hook labeling during compilation so runtime traces stay readable without hand-editing your components.

Why Use It

This package gives Babel-based apps automatic component and hook labeling without taking over runtime startup. The plugin owns build-time injection only, while your app bootstrap still decides when tracing starts, whether the Dashboard is mounted, and whether tracing stays dormant until you open a narrow capture window.

Recommended Babel path: use @autotracer/plugin-babel-react18 for build-time injection, initialize reactTracer() before your client entry renders, and mount @autotracer/dashboard yourself when you want the standard browser control workflow in restricted internal builds. When the Dashboard is not mounted, use the lower-level globalThis.autoTracer runtime control surface.

Installation

pnpm add @autotracer/react18
pnpm add -D @autotracer/plugin-babel-react18

If this internal browser app uses the Dashboard as its normal control surface, add it separately:

pnpm add -D @autotracer/dashboard

Configuration

Add the plugin to your Babel configuration:

{
  "plugins": [
    [
      "@autotracer/plugin-babel-react18",
      {
        "mode": "opt-out"
      }
    ]
  ]
}

To keep tracing out of publicly accessible production builds on the Babel path, exclude the plugin from the production Babel config itself:

const shouldTrace =
  process.env.NODE_ENV === "development" ||
  process.env.INTERNAL_QA === "true";

module.exports = {
  plugins: [
    ...(shouldTrace
      ? [
          [
            "@autotracer/plugin-babel-react18",
            {
              mode: "opt-out",
            },
          ],
        ]
      : []),
  ],
};

On the Babel path, runtime gating alone is not enough. If the plugin stays enabled in a production build, Babel still injects useReactTracer() and hook labeling into compiled components.

Use these documentation pages for exact option behavior:

  • React integration path: https://docs.autotracer.dev/guide/config-react
  • Babel plugin settings: https://docs.autotracer.dev/reference/build/react18/babel/
  • Babel pragma comments: https://docs.autotracer.dev/reference/build/react18/babel/pragmas
  • Runtime settings: https://docs.autotracer.dev/reference/runtime/react18/
  • Runtime API: https://docs.autotracer.dev/api/react18
  • Dashboard workflow: https://docs.autotracer.dev/dashboard/webapps

Theme customization stays on the runtime side through reactTracer({ colors }). File-based theme loading is available only on the Vite plugin path through https://docs.autotracer.dev/themes/react18/api.

Keep this plugin out of publicly accessible builds. The intended use case is development and restricted internal test or QA environments.

Usage

Add the plugin in Babel, then initialize the runtime separately before your client entry renders:

const shouldTrace =
  process.env.NODE_ENV === "development" ||
  process.env.NEXT_PUBLIC_INTERNAL_QA === "true";

async function bootstrap(): Promise<void> {
  if (shouldTrace) {
    const { reactTracer, isReactTracerInitialized } =
      await import("@autotracer/react18");

    if (!isReactTracerInitialized()) {
      reactTracer({
        enabled: false,
      });
    }
  }
}

void bootstrap();

Use the same environment decision for both the Babel plugin and the runtime bootstrap so internal builds get tracing and publicly accessible builds get neither injection nor runtime startup.

Use the guide that matches your actual entry path when you need full bootstrap examples:

  • Next.js Pages Router: https://docs.autotracer.dev/guide/installation-react-nextjs-pages
  • Next.js App Router: https://docs.autotracer.dev/guide/installation-react-nextjs-app
  • Create React App: https://docs.autotracer.dev/guide/installation-react-cra

Use pragma comments when you want component-level control inside eligible files:

// @trace
export function Counter() {
  return <button>Count</button>;
}

In browser-based internal web apps, the normal control surface is the Dashboard. On this Babel path, you mount it yourself. When the Dashboard is not mounted, use the lower-level globalThis.autoTracer.reactTracer API in tests, automation, and other non-Dashboard setups.

License

MIT © Carl Ribbegårdh