@reticlehq/next gives Next.js users the same data-reticle-source stamping the Vite plugin does, without asking them to migrate to Babel.
Version 2.8.0. Apache 2.0. CommonJS, no build step. Depends on @babel/core and @reticlehq/babel-plugin. Peer dependency: next >= 13.
Why it exists
Next users are on SWC. Telling them to switch to Babel for a dev tool would be a rude trade, and it would slow down every build they run. This adds a dev-only pre-loader for.jsx and .tsx and leaves the rest of the pipeline alone.
Install and use
This package is CommonJS on purpose.
next.config.js is loaded by Node before any ESM transform,
so an ESM-only helper would fail at the least helpful possible moment.Exports
.
NODE_ENV === 'production'. Otherwise it merges in:
readPairingToken() is also exported at runtime. It is not declared in index.d.ts, so TypeScript will not see it.
./loader
.jsx or .tsx, and anything under node_modules. It lazily imports @reticlehq/babel-plugin and runs babel.transformAsync with configFile: false, babelrc: false, retainLines, and source maps on.
The loader never fails the build. Any error falls back to the original source, because a dev-only
source stamp is not worth breaking someone’s
next dev over.What it does not do
It does not injectconnect(). On Next you call it yourself, once, in a client component:
Framework by framework
What each supported stack needs, and what it gets for free.