Skip to content

exclude

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


exclude is a build configuration option passed to @autotracer/plugin-babel-react18 in your Babel config. It removes files and component names from the eligible set before pragma comments are evaluated.

paths uses glob patterns matched against the normalized filename Babel passes to the plugin. 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 path exclusions are kept.

By default, the plugin already excludes tests, build output folders, coverage folders, and common dependency folders. exclude is the setting you use when the default eligible set still includes React code that should never be instrumented.

Read together with include and mode when you are deciding what the plugin must leave alone.

Default

typescript
{
  paths: [
    "**/*.test.*",
    "**/*.spec.*",
    "**/node_modules/**",
    "**/dist/**",
    "**/build/**",
    "**/.next/**",
    "**/coverage/**",
    "**/tests/**",
    "**/test/**",
    "**/__tests__/**",
  ],
  components: [],
}

How Exclusion Works

  1. exclude.paths removes matching files before component pragmas are considered.
  2. exclude.components removes matching component names inside files that are otherwise still eligible.
  3. These exclusions still apply in both "opt-in" and "opt-out" modes.
  4. @trace cannot override an explicit exclude match.

Fields

  • paths skips whole files and folders before transformation.
  • components skips matching component names inside otherwise eligible files.

When To Set It

  • Leave the defaults when the built-in test and build-output exclusions are enough.
  • Add exclusions when specific files, folders, or component families must stay out of instrumentation even though they are otherwise eligible.

Usage

javascript
{
  "plugins": [
    [
      "@autotracer/plugin-babel-react18",
      {
        "exclude": {
          "paths": ["**/*.spec.*", "**/*.test.*", "src/legacy/**"],
          "components": [/^Internal/, "Debug*"]
        }
      }
    ]
  ]
}

Released under the MIT License.