My preferred babel config.

Usage no npm install needed!

<script type="module">
  import alanscodelogBabelPreset from 'https://cdn.skypack.dev/@alanscodelog/babel-preset';



My preferred babel config (as a preset) for transpiling typescript with path alias* support and optional es modules support**.

* @/, @tests, and @utils (for my utils package). ** Requires use of my other package dts-alias if using tsc to output types.


yarn add -D @alanscodelog/babel-preset \\
@babel/core \\
@babel/preset-env \\
@babel/preset-typescript \\
@babel/plugin-proposal-class-properties \\
@babel/plugin-proposal-export-namespace-from \\
babel-plugin-module-resolver \\
babel-plugin-add-import-extension \\ #optional, see ES Modules below


Set babel config and browserslist (targets for @babel/preset-env are unset) in package.json.

// package.json
"babel":{ "presets":["@alanscodelog"] },
"browserslist": "...",

ES Modules

Can optionally output es modules by adding --env-name modern to the end of the babel command. Requires babel-plugin-add-import-extension if we don't want to have to be writing extensions.