Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@4c/babel-preset

4Catalyzer2.5kMIT10.2.1

4Catalyzer babel preset

readme

@4c/babel-preset

A configurable, batteries included, babel preset for libraries and web apps.

Includes the following presets and plugins:

Install

yarn add @4c/babel-preset -D

Configure

Without options:

{
  "presets": ["@4c"]
}

With options;

{
  "presets": [
    [
      "@4c",
      {
        "target": "web-app",
        "modules": false,
        "intl": { "prefix" "@mylib" },
      }
    ]
  ]
}

Options

In addition to the options below, all preset-env are accepted to be overridden when the defaults aren't sufficient. By default the preset picks a set of known safe combinations tailored to the chosen target.

target

'web' | 'web-app' | 'node', defaults to 'web'

The overall build environment target. Used to set some smart presets as well as configure the preset-env targets.

node

  • targets set to node 10 in production and current in development
  • modules set to commonjs
  • intl is disabled

web

  • targets uses the browserlist config is (determined by .browserslistrc, etc) if available or defaults to ['ie >= 11', 'last 2 Edge versions', 'last 4 Chrome versions', 'last 4 Firefox versions', 'last 2 Safari versions'];

web-app

  • uses the same targets as web
  • defaults modules to false
  • defaults runtime to true

development

boolean, defaults to false

Uses a more development friendly set of targets as well as toggles development plugins for react (see. When true the current version of node for node targets and esmodules for web targets. You can read more here.

modules

"commonjs' | false, defaults to false except when target is 'web-app' and 'commonjs' otherwise

The preset-env modules option. controls the output module format

runtime

Turns on the babel runtime transform.

intl

boolean | { prefix: string, messagesDir: string }

Configures the react-intl babel plugin to extract and output localized strings prefixed by the package name or provided prefix

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

10.2.1 (2022-08-29)

Bug Fixes

  • throw duplicate error on extraction (7fc244a)

10.2.0 (2022-08-10)

Features

10.1.0 (2022-05-19)

Features

  • enable toggling message extraction (18b809b)

10.0.1 (2022-05-19)

Bug Fixes

  • include intl in dev mode (40ed224)

10.0.0 (2022-05-18)

Features

  • finally upgrade to formatjs plugin (3b400ea)

BREAKING CHANGES

  • intl settings, prefix must be provided to be used, otherwise defaults to generating ids when not present

9.1.0 (2021-11-29)

Features

9.0.0 (2021-10-07)

Features

  • use automatic jsx runtime by default (e797773)

BREAKING CHANGES

  • default to new runtime react >= 17 set reactRuntime: 'classic' to turn off.

8.1.2 (2021-09-16)

Bug Fixes

8.1.1 (2021-06-07)

Bug Fixes

8.1.0 (2021-06-03)

Features

8.0.4 (2021-04-07)

Bug Fixes

  • includePolyfill option toggling (9d57722)

8.0.3 (2021-01-25)

Bug Fixes

  • need to use 7.x of babel-plugin-react-intl (#675) (7cf8084)

8.0.2 (2020-12-10)

Note: Version bump only for package @4c/babel-preset

8.0.1 (2020-09-24)

Bug Fixes

Reverts

  • Revert "chore(deps): update dependency babel-plugin-react-intl to v8 (#653)" (#654) (4ca69ab), closes #653 #654

8.0.0 (2020-09-21)

Bug Fixes

Features

  • update core preset and improve polyfill behavior (#644) (772c3ca)

BREAKING CHANGES

  • corejs2 is no longer supported
  • default browsers changed to "esmodules"

7.4.1 (2020-08-24)

Note: Version bump only for package @4c/babel-preset

7.4.0 (2020-08-20)

Features

7.3.6 (2020-05-27)

Bug Fixes

7.3.5 (2020-05-22)

Note: Version bump only for package @4c/babel-preset

7.3.4 (2020-03-17)

Note: Version bump only for package @4c/babel-preset

7.3.3 (2020-02-26)

Note: Version bump only for package @4c/babel-preset

7.3.2 (2020-02-13)

Note: Version bump only for package @4c/babel-preset

7.3.1 (2020-02-12)

Note: Version bump only for package @4c/babel-preset

7.3.0 (2020-01-16)

Features

7.2.4 (2019-12-10)

Note: Version bump only for package @4c/babel-preset

7.2.3 (2019-12-10)

Note: Version bump only for package @4c/babel-preset

7.2.2 (2019-11-27)

Note: Version bump only for package @4c/babel-preset

7.2.1 (2019-11-13)

Note: Version bump only for package @4c/babel-preset

7.2.0 (2019-11-02)

Features

  • add @babel/plugin-proposal-nullish-coalescing-operator (#470) (14c5d47)
  • Bump Node version in Babel preset (#427) (7af012b)

7.1.0 (2019-10-08)

Features

7.0.2 (2019-10-08)

Bug Fixes

7.0.1 (2019-10-08)

Bug Fixes

  • Clean up Babel preset a bit (ec17308)

7.0.0 (2019-08-14)

chore

BREAKING CHANGES

  • This probably breaks something.

6.0.3 (2019-08-05)

Bug Fixes

6.0.2 (2019-08-02)

Bug Fixes

6.0.1 (2019-06-27)

Bug Fixes

6.0.0 (2019-06-27)

Features

  • split corejs options for runtime and env (#238) (111e305)

BREAKING CHANGES

  • corejs has been split into envCorejs and corejs, generally only use the former

5.2.0 (2019-05-06)

Features

5.1.0 (2019-03-25)

Features

5.0.4 (2019-03-20)

Bug Fixes

  • Only set env-preset core-js when using built-ins (#97) (08d0b77)

5.0.3 (2019-03-20)

Bug Fixes

5.0.2 (2019-03-20)

Bug Fixes

5.0.1 (2019-03-19)

Note: Version bump only for package @4c/babel-preset

5.0.0 (2019-03-19)

Features

  • change env handling to explicit development option (#73) (dab06cc)

BREAKING CHANGES

  • env is not used to determine targets anymore

4.1.5 (2019-03-07)

Bug Fixes

  • Fix targets handling in Babel preset (#68) (05dfb6a)

4.1.4 (2019-02-26)

Bug Fixes

  • Remove no-longer-necessary workaround (#50) (7b004b9)

4.1.3 (2019-02-11)

Bug Fixes

  • Only exclude transform-classes on web (#47) (435093f)

4.1.2 (2019-01-29)

Note: Version bump only for package @4c/babel-preset

4.1.1 (2019-01-29)

Note: Version bump only for package @4c/babel-preset

4.1.0 (2018-10-19)

Features

  • support FormattedMessage intl components for namespaces (#17) (e6fba0e)

4.0.0 (2018-10-18)

Features

  • allow browserlist configs more easily (#16) (f03ff28)

BREAKING CHANGES

  • browserlist configs will be used by default if they exist over the default browsers

3.1.1 (2018-09-13)

Bug Fixes

3.1.0 (2018-09-13)

Features

3.0.0 (2018-08-28)

Features

BREAKING CHANGES

  • runtime doesn't polyfill corejs

2.1.0 (2018-07-14)

Features

2.0.0 (2018-06-14)

Bug Fixes

  • option passThrough for preset env (1f3efa6)

Features

  • add babel runtime option (d46cfbb)

BREAKING CHANGES

  • runtime enabled by default for web-app targets

1.5.0 (2018-05-24)

Features

  • Pass through explicit preset-env include (c9afb91)

1.4.0 (2018-04-25)

Features

1.3.0 (2018-04-25)

Features

  • bump babel dependencies (34d9ba5)

1.3.0 (2018-04-02)

Features

  • bump babel dependencies (34d9ba5)