Registry / devops / babel-plugin-optimize-react

babel-plugin-optimize-react

JSON →
library0.0.4jsnpmunverified

A Babel plugin that optimizes React code by transforming common patterns like named imports from React, array destructuring from hooks, and React.createElement into more efficient output. The last released version is 0.0.4 (March 2019) and it is no longer maintained; the repository is archived as part of the Create React App monorepo. It only works with Babel 7 and is intended as an experimental optimization, not for production use.

npm install babel-plugin-optimize-react
INSTALL
IMPORT
SIG · BABEL-PLUGIN-OPTIM
B
babel-plugin-optimize-react
devopsjavascriptv0.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = require('babel-plugin-optimize-react')
import plugin from 'babel-plugin-optimize-react'
CommonJS only; no ESM exports.
babelrc plugin string
plugins: ['babel-plugin-optimize-react']
plugins: ['optimize-react']
Full package name required in .babelrc or babel.config.js.

Shows how to install and configure the plugin in Babel config.

// Install npm install --save-dev babel-plugin-optimize-react // Then in .babelrc or babel.config.js: { "plugins": ["babel-plugin-optimize-react"] }
Debug
Known issues
deprecatedPlugin is archived and no longer maintained.
fix
Consider not using this plugin; it was experimental.
affects: all
gotchaOnly works with Babel 7; not compatible with Babel 6.
fix
Upgrade to Babel 7.
affects: 0.0.x
gotchaMay cause unexpected behavior with custom hooks or non-standard React imports.
fix
Test thoroughly before using in production.
affects: all
Errors
Common errors & fixes
Cannot find module 'babel-plugin-optimize-react'
Plugin not installed or typo in package name.
fix
Run 'npm install --save-dev babel-plugin-optimize-react' and check spelling.
Error: Plugin/preset files are not allowed to export objects, only functions.
Using ESM import syntax with require-based plugin.
fix
Use CommonJS require or configure Babel to handle ESM plugins.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
@babel/corerequiredpeer dependency for Babel plugin
Agent activity
8 hits · last 30 days
node
8
Resources
babel-plugin-optimize-react — npm install babel-plugin-optimize-react · libregistry