babel-preset-kyt-react
raw JSON → 1.3.20 verified Sat Apr 25 auth: no javascript
An opinionated Babel preset for React applications, intended to be used with the kyt build tool from The New York Times. Version 1.3.20 is the latest stable release, part of the kyt monorepo. It provides a preconfigured Babel setup for React with support for common modern JavaScript features. Unlike generic presets like @babel/preset-react, this preset is tailored for kyt's specific project structure and includes its own set of plugins. The package has low release cadence, primarily receiving version bumps alongside other kyt packages. Key differentiator is its seamless integration with the kyt build system, which handles configuration for Webpack, Babel, and ESLint.
Common errors
error Cannot find module 'babel-preset-kyt-react' ↓
cause Package not installed or incorrect import path in babel config
fix
Run 'npm install babel-preset-kyt-react' and use presets: ['kyt-react'] or presets: ['babel-preset-kyt-react']
error Error: Plugin/Preset files are not allowed to export objects, only functions. ↓
cause Multiple copies of Babel or incorrect version mismatch
fix
Ensure @babel/core is installed and version matches; use 'npm dedupe' or reinstall dependencies
error ReferenceError: regeneratorRuntime is not defined ↓
cause Missing @babel/plugin-transform-runtime or @babel/runtime
fix
Add '@babel/plugin-transform-runtime' to plugins and install @babel/runtime as a dependency
Warnings
deprecated Plugin @babel/plugin-proposal-class-properties is deprecated as of Babel 8 ↓
fix Upgrade Babel to v8 and switch to @babel/plugin-transform-class-properties or remove if using preset-env with shippedProposals.
gotcha Preset name must be 'kyt-react' not 'babel-preset-kyt-react' when using kyt framework's default config resolution ↓
fix Use 'kyt-react' as preset name in babel config when using kyt.
gotcha This preset is tightly coupled with kyt; using it standalone without kyt may cause unexpected behavior ↓
fix Ensure you are using the kyt build tool or manually configure missing plugins.
Install
npm install babel-preset-kyt-react yarn add babel-preset-kyt-react pnpm add babel-preset-kyt-react Imports
- default (preset) wrong
module.exports = { presets: ['babel-preset-kyt-react'] }correctmodule.exports = { presets: ['kyt-react'] } - babel-preset-kyt-react wrong
import { preset } from 'babel-preset-kyt-react'correctmodule.exports = { presets: ['babel-preset-kyt-react'] } - module.exports wrong
export default { presets: ['kyt-react'] }correctmodule.exports = { presets: [['kyt-react', { runtime: 'automatic' }]] }
Quickstart
// Install with kyt: npm install kyt babel-preset-kyt-react@1.3.20
// In babel.config.js:
module.exports = {
presets: [
['kyt-react', {
runtime: 'automatic' // optional, for React 17+ JSX transform
}]
]
}
// Then run: npx kyt build