@alanscodelog/babel-preset
v2.0.0
Published
My preferred babel config.
Downloads
11
Readme
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.
Install
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
Usage
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.