@nake/babel-preset
Babel preset for transforming your future JS/JSX and TypeScript code
Last updated 2 years ago by laozhu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nake/babel-preset 
SYNC missed versions from official npm registry.

@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

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |