babel-preset-moon
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

babel-preset-moon

build status npm version npm license

A modern Babel preset with built-in TypeScript support. Is designed for unit testing, linting, and local development only -- it should not be used for web applications or package building (use Packemon instead).

yarn add --dev babel-preset-moon

Setup

Add the preset to your root babel.config.js.

module.exports = {
  presets: ['moon'],
};

Features

  • Configures the env preset for the current Node.js version.
  • Enables the typescript preset by default. TypeScript everywhere!
  • Enables native async/await and avoids Regenerator.
  • Enables export default and namespace from syntax.
  • Supports the react preset and both JSX runtimes.
  • Supports the solid preset with SSR and hydration.
  • Converts __DEV__, __PROD__, and __TEST__ to process.env checks.
  • Wraps invariant() in process.env conditionals.

Options

The following options can be passed to the preset.

  • decorators (boolean) - Enable TypeScript decorators. If true, will toggle Babel into loose mode. Defaults to false.
  • loose (boolean) - Turn on Babel loose mode for all plugins. Defaults to false.
  • modules (boolean) - Force transpilation to use ECMA script module syntax. Defaults to false (auto modules).
  • react (boolean | classic | automatic) - Enable the React plugin and the defined JSX runtime. Defaults to false.
  • solid (boolean | ssr) - Enable the Solid.js plugin. Hydration is always enabled.
  • targets (Record<string, string> | string[] | string) - Override the target environment. Defaults to Node.js current.
module.exports = {
  presets: [['moon', { decorators: true, react: 'automatic' }]],
};

Package Sidebar

Install

npm i babel-preset-moon

Weekly Downloads

98

Version

3.0.1

License

MIT

Unpacked Size

11.3 kB

Total Files

8

Last publish

Collaborators

  • milesj