Skip to content

include

Package: @autotracer/plugin-vite-react18  ·  Layer: Build  ·  Type: object  ·  Default: see below


include is a build configuration option for reactTracer.vite() — the Vite plugin initializer of the @autotracer/plugin-vite-react18 React build-time injection package. It defines which files and component names are eligible for injection before pragma comments are evaluated.

paths uses glob patterns relative to the project root. components accepts exact names, glob-like strings, or regular expressions.

This option is deep-merged with the plugin defaults. If you provide only components, the default paths value is kept.

By default, the plugin considers every .tsx and .jsx file eligible and applies no component-name filter. include is the setting you use when that default eligible set is too broad.

Read together with exclude and mode when you are narrowing the eligible set.

Default

typescript
{
  paths: ["**/*.{tsx,jsx}"],
  components: [],
}

In the default "opt-out" mode, that means most React component files start eligible unless another setting removes them.

How Eligibility Works

  1. exclude removes files before include is checked.
  2. include.paths decides which remaining files are eligible for transformation.
  3. include.components and exclude.components decide which component names inside those eligible files can still be instrumented.
  4. Pragma comments such as @trace and @trace-disable run only inside that eligible set. @trace cannot bypass an include miss or an explicit exclude match.

Fields

  • paths filters which files are considered for transformation.
  • components filters which component names inside eligible files can be instrumented.

Usage

typescript
reactTracer.vite({
  include: {
    paths: ["src/**/*.tsx", "app/**/*.tsx"],
    components: ["App", "User*", /^Dashboard/],
  },
});

Released under the MIT License.