Skip to content

Pragma Comments

Package: @autotracer/plugin-vite-react19  ·  Layer: Build  ·  Type: Reference


Pragma comments are build-time line comments that reactTracer.vite() reads while transforming eligible React components.

They are not a React feature and they are not JavaScript directives. In AutoTracer, they are per-component override comments used during build-time injection.

Use them immediately above an eligible top-level component declaration. The shared React 19 transformer reads function-level leading comments for top-level component declarations and component variable declarations.

Read together with mode, include, and exclude.

Supported Comments

@trace

Use // @trace to enable instrumentation for one eligible component.

ts
// @trace
export function CheckoutPanel() {
  return <section />;
}

@trace-disable

Use // @trace-disable to disable instrumentation for one eligible component.

ts
// @trace-disable
export function AnimatedSpinner() {
  return <div />;
}

Precedence

  1. A file and component must pass include and exclude first.
  2. Inside that eligible set, @trace-disable wins over @trace.
  3. mode decides the fallback only when no pragma settled the result.

@trace never rescues a component that misses include or matches exclude.

Released under the MIT License.