include
Package: @autotracer/plugin-babel-react18 · Layer: Build · Type: object · Default: see below
include is a build configuration option passed to @autotracer/plugin-babel-react18 in your Babel config. It defines which files and component names are eligible for injection 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 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
{
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
excluderemoves files beforeincludeis checked.include.pathsdecides which remaining files are eligible for transformation.include.componentsandexclude.componentsdecide which component names inside those eligible files can still be instrumented.- Pragma comments such as
@traceand@trace-disablerun only inside that eligible set.@tracecannot bypass anincludemiss or an explicitexcludematch.
Fields
pathsfilters which files are considered for transformation.componentsfilters which component names inside eligible files can be instrumented.
Path Matching Note
The Babel plugin normalizes Windows and Unix path separators before matching. If a pattern is not absolute and does not already start with **/, AutoTracer also tests it with a leading **/. That means patterns such as src/**/*.tsx can still match an absolute filename Babel reports from somewhere under /src/.
Usage
{
"plugins": [
[
"@autotracer/plugin-babel-react18",
{
"include": {
"paths": ["src/**/*.tsx", "app/**/*.tsx"],
"components": ["App", "User*", /^Dashboard/]
}
}
]
]
}