1.1.1 • Published 3 years ago

@considonet/babel-preset-typescript v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@considonet/babel-preset-typescript

Configurable TypeScript preset for Babel 7.x supporting Vue.js TS SFC, React, JS and TypeScript

What is this?

This preset was created as a part of G-Build evolution. Starting from version 4.0, there are no longer configuration files for Babel and these have to be provided manually (as they are project-specific). Because all our existing legacy projects have exactly the same config, this package makes the transition to G-Build 4 and Babel TypeScript transpilation easy. Also it provides a setup which was proven to work for us.

This preset loads the following presets and plugins:

Options

  • vue (boolean, default: false) - enables TS Vue SFCs transpilation. Because the check is a potentially expensive operation, it is disabled by default. Once enabled, it replaces @babel/preset-typescript with our own babel-preset-typescript-vue

  • react (boolean, default: true) - enables @babel/preset-react

  • presetEnvSettings (object, default: see below) - configures @babel/preset-env.

Parameter is optional. The default setup is as follows:

{
  "modules": "auto",
  "useBuiltIns": "usage",
  "corejs": 3
}

Please refer to @babel/preset-env docs for more details.

  • presetReactSettings (object, default: see below) - configures @babel/preset-react if react set to true.

Parameter is optional. The default setup is the preset's default setup.

Please refer to @babel/preset-react docs for more details. It's a good place to set runtime to automatic if you're already using React 17.

Install

Using npm:

npm install --save-dev @considonet/babel-preset-typescript

or using yarn:

yarn add @considonet/babel-preset-typescript --dev