Learn how companies like Phone2Action are using npm in their front-end developmentJoin the conversation »

@nake/babel-preset

1.0.2 • Public • Published

@nake/babel-preset

Babel preset for transforming your future JS/JSX and TypeScript code

This babel preset is extended from preset-env, preset-react and preset-typescript, you can enable parts of them with simple opitons. This babel preset enabled almost all TC39 experimental proposals by default, you can disable them as you need.

Features

  • Reasonable default options
  • Confiurable for various scenarios
  • Auto polyfilled based on browserslist and node version
  • Support experimental ES proposals out of box
  • Support react and typescript out of box
  • React compile-time code optimization
  • Works great with @nake/eslint-config

Installation

# Install with npx 
$ npx install-peerdeps --dev @nake/babel-preset
 
# Install with yarn 
$ yarn add --dev @babel/core @nake/babel-preset

Use npx to install peerdeps automatically or install peerDependencies with npm/yarn manually.

Usage

Default

Default preset support React and all TC39 experimental proposals.

// babel.config.js
module.exports = {
  presets: ['@nake/babel-preset'],
};

TypeScript

Preset support both React and TypeScript.

// babel.config.js
module.exports = {
  presets: [['@nake/babel-preset', { typescript: true }]],
};

You should change default extensions from .js to .ts, below is a babel CLI example.

{
  "scripts": {
    "start": "NODE_ENV=development babel src --extensions .ts --watch --out-dir dist",
    "build": "NODE_ENV=production babel src --extensions .ts --out-dir dist"
  }
}

To be continue

under construction...

License

MIT

Install

npm i @nake/babel-preset

DownloadsWeekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

15.7 kB

Total Files

29

Last publish

Collaborators

  • avatar