Skip to content

best-shot/babel-preset-evergreen

Repository files navigation

babel-preset-evergreen logo

A babel preset for modern javascript syntaxes.

npm github node

This preset can transform:

  • ECMAScript 2024 syntax

Installation

npm install babel-preset-evergreen --save-dev

Usage

// example: babel.config.json
{
  "targets": "chrome >= 60",
  "presets": [
    [
      "evergreen",
      {
        "polyfill": {
          "usage": "global"
        }
      }
    ]
  ]
}

Options

polyfill

  • type: false | {}
  • default: false

polyfill.usage

  • type: ['global','pure']
  • default: 'global'

How babel handles polyfills.

References: babel/babel#10008

polyfill.include

  • type: string[]
  • example: ['web.url']

polyfill.exclude

  • type: string[]
  • example: ['web.url']

polyfill.mini

  • type: boolean
  • default: false
  • description: Use miniprogram presets.

Tips

You might need to pin core-js@3 when your project dependency tree has core-js@2:

npm install core-js@3