A Babel plugin (v1.0.0, no update cadence known) that transforms JSX files into self-registering templates by injecting a call to a global `register` function at the end of each module. It allows defining templates as standalone JSX files and importing them via a shared registry object. Differentiator: enables code-splitting of templates without explicit imports by using file-system conventions. Requires @babel/core >= 7.0.0. Deprecated in favor of modern patterns like dynamic imports and React.lazy.
npm install babel-plugin-transform-react-templatesNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures Babel to auto-register JSX templates, defines a helper module with register function and templates object, creates a template file, and uses the registered template in a ReactDOM call.
Migrate to explicit imports or React.lazy for code-splitting.
Ensure templates are imported or use Webpack's require.context or similar to include them.
Verify Babel includes the template files (e.g., via `includes` option).
Place this plugin early in the plugins array.
npm install --save-dev babel-plugin-transform-react-templates
Use ['transform-react-templates', options] instead of 'transform-react-templates'.