/babel-preset-typescript

Default preset for ConsidoNet projects using JS, TS, Vue and React

Primary LanguageJavaScriptMIT LicenseMIT

@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 proved 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.

The default setup is as follows:

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

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

Install

Using npm:

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

or using yarn:

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