babel-preset-atomic

raw JSON →
5.0.0 verified Sat Apr 25 auth: no javascript

A Babel preset optimized for Electron and Node.js environments, maintained by atom-ide-community. Current stable version is 5.0.0 targeting Electron 11. Release cadence is irregular. Key differentiators: includes TypeScript, React, Flow support; configurable targets; previously bundled @babel/core as dependency (v4.1.0-4.3.0) but now requires peer dependencies. Supports both ESM and CJS.

error Error: Cannot find module '@babel/core'
cause Missing peer dependency @babel/core
fix
npm install --save-dev @babel/core
error Error: Preset [object Object] is invalid. Expected a string or an array of [presetName, options]
cause Used import or incorrect module.exports pattern in Babel config
fix
Replace import with module.exports = { presets: ['babel-preset-atomic'] } or require('babel-preset-atomic') as the preset name.
error Error: Unknown option: .targets. Check that it is correct
cause Preset options are incorrectly placed or typo in targets
fix
Verify targets is an object: { targets: { electron: '11' } }
error Error: Requires Babel ">=7" but was loaded with "6.x"
cause Incompatible Babel version (6.x) installed
fix
Upgrade to Babel 7: npm install --save-dev @babel/core@^7
breaking v5.0.0 changed default Electron target to 11. Projects targeting older Electron versions must specify targets option explicitly.
fix Add { targets: { electron: '9' } } to preset options for Electron 9 compatibility.
breaking v4.0.0 dropped automatic Electron 5 targeting. Must provide targets option for Electron 5.
fix Add { targets: { electron: '5' } } to preset options for Electron 5.
deprecated Including @babel/core as a dependency was deprecated after v4.3.0. Now it is a peer dependency.
fix Install @babel/core as a devDependency: npm install --save-dev @babel/core
gotcha The preset does not export a default but uses module.exports. CommonJS require('babel-preset-atomic') returns an object, not a function. Direct import may fail.
fix Use require('babel-preset-atomic') as a string in Babel config or use module.exports = require('babel-preset-atomic') if you need to modify.
deprecated TypeScript support from v4.4.0 uses @babel/preset-typescript. Previous versions used a custom transformer which may have different behavior.
fix No action needed, but review TypeScript-specific options (e.g., isTSX, jsxPragma).
npm install babel-preset-atomic
yarn add babel-preset-atomic
pnpm add babel-preset-atomic

Shows how to configure the preset with Electron 11 target, TypeScript and React support, then compile a file.

// babel.config.js
module.exports = {
  presets: [
    ['babel-preset-atomic', {
      targets: {
        electron: '11'
      },
      typescript: true,
      react: true
    }]
  ]
};

// Then create an index.js with modern JS
const greet = (name: string) => `Hello, ${name}!`;
console.log(greet('World'));

// Run: npx babel index.js --out-file index.bundle.js