@reticlehq/babel-plugin puts the source location back. React 19 dropped _debugSource, which is what source mapping used to rely on, so without this the tools can tell you the component name but not the file.
Version 2.8.0. Apache 2.0. CommonJS. No runtime dependencies. Peer dependency: @babel/core ^7.
What it stamps
becomes, in dev only:
The path is relative to process.cwd(), with backslashes normalized to forward slashes. A file with no name stamps unknown.
What it skips
- Component tags. Only lowercase host elements are stamped, because a component’s own JSX gets stamped where it is defined.
- Elements that already carry the attribute.
- Nodes with no location information.
- Anything whose tag name is not a plain
JSXIdentifier.
Do you install it?
Only if you are wiring Babel yourself. @reticlehq/vite-plugin and @reticlehq/next both pull it in.
The export
One export, via export =. There are no named exports and no default interop wrapper, because Babel require()s the module and takes the object directly.
The Babel plugin name is reticle-source. Its visitor handles JSXOpeningElement only.
It takes no options. The plugin reads nothing from state.opts.
Wiring it by hand
Do not write require('@reticlehq/babel-plugin').default. With export = there is no .default,
and an old README example got this wrong.
Why an attribute rather than a runtime lookup
The stamp survives minification of everything else, costs nothing at runtime, and is readable from the DOM node itself. That is what lets reticle_inspect answer with a file and a line rather than a component name and a shrug.