2.12.0 • Published 9 months ago

@parcel/transformer-babel v2.12.0

Weekly downloads
23,009
License
MIT
Repository
github
Last release
9 months ago

@parcel/transformer-babel

This Parcel transformer plugin is responsible for transforming assets with Babel. It uses @babel/core to resolve babel config the same way Babel does and uses that if found. If no filesystem config is found it uses a default config that supports the most common cases.

Default config

  • @babel/preset-env - Uses the targets defined in package.json or a default set of targets if none are defined to pass to @babel/preset-env as options. It runs over all source code as well as installed packages that have a browserslist with higher targets than the app being built by Parcel.
  • @babel/plugin-flow-strip-types - Right now it configures the flow plugin which uses the ast to check if there is a flow directive and strips types if so TODO: It should do a cheap check of the code and only apply the plugin if a flow directive is found as it may affect parsing when it shouldn't
  • @babel/plugin-transform-typescript - Configured for files with extenions .ts and .tsx
  • @babel/plugin-transform-react-jsx - Configured if file has extension .jsx or if a React like dependency is found as a dependency in package.json.

Custom config perf warnings

Parcel now supports all configuration formats that Babel supports, but some of them come with negative performance impacts.

  • babel.config.js/.babelrc.js - Since Babel 7, config files as JS are now supported. While this provides flexibility it hurts cacheability. Parcel cannot cache using the contents of the these files because the config they return is non deterministic based on content alone. Imported dependencies may change or the results may be based on environment variables. For this reason Parcel has to resolve load these files on each build and make sure their output is still the same. Another downside to using JS config files is that they end up being require()ed by Babel so Parcel cannot rebuild when the file changes in watch mode. To avoid these performance penalties, it is suggested that you use a babel.config.json or .babelrc file instead.
  • require('@babel') - With the advent of JS config files, it is now possible to directly require presets and plugins in configs instead of using names or paths that are resolved by Babel. Unfortunately this gives Parcel no information about which plugins/presets were used in a transformation so Parcel will be forced to run the Babel transformations on every build. It is suggested to avoid this type of configuration.
2.0.0-canary.1733

9 months ago

2.0.0-canary.1727

10 months ago

2.0.0-canary.1728

10 months ago

2.0.0-canary.1732

9 months ago

2.0.0-canary.1730

10 months ago

2.0.0-canary.1731

10 months ago

2.0.0-canary.1721

11 months ago

2.0.0-canary.1722

11 months ago

2.0.0-canary.1700

12 months ago

2.0.0-canary.1702

12 months ago

2.0.0-canary.1707

12 months ago

2.0.0-canary.1709

12 months ago

2.0.0-canary.1704

12 months ago

2.0.0-canary.1705

12 months ago

2.0.0-canary.1706

12 months ago

2.0.0-canary.1720

11 months ago

2.0.0-canary.1710

12 months ago

2.0.0-canary.1712

11 months ago

2.0.0-canary.1713

11 months ago

2.0.0-canary.1718

11 months ago

2.0.0-canary.1719

11 months ago

2.0.0-canary.1714

11 months ago

2.0.0-canary.1715

11 months ago

2.0.0-canary.1716

11 months ago

2.0.0-canary.1717

11 months ago

2.0.0-dev.1712

11 months ago

2.0.0-canary.1693

12 months ago

2.0.0-canary.1694

12 months ago

2.0.0-canary.1690

12 months ago

2.0.0-canary.1688

12 months ago

2.0.0-canary.1685

12 months ago

2.0.0-canary.1687

12 months ago

2.0.0-canary.1699

12 months ago

2.0.0-canary.1695

12 months ago

2.0.0-canary.1696

12 months ago

2.0.0-canary.1697

12 months ago

2.0.0-dev.1604

1 year ago

2.0.0-dev.1605

1 year ago

2.0.0-dev.1632

1 year ago

2.0.0-dev.1652

1 year ago

2.0.0-dev.1680

1 year ago

2.0.0-dev.1602

1 year ago

2.0.0-dev.1601

1 year ago

2.0.0-dev.1608

1 year ago

2.0.0-dev.1603

1 year ago

2.0.0-dev.1584

1 year ago

2.0.0-dev.1586

1 year ago

2.0.0-dev.1577

1 year ago

2.0.0-dev.1557

1 year ago

2.0.0-dev.1574

1 year ago

2.0.0-dev.1573

1 year ago

2.0.0-dev.1572

1 year ago

2.0.0-dev.1565

1 year ago

2.0.0-dev.1431

1 year ago

2.0.0-dev.1430

1 year ago

2.0.0-dev.1429

1 year ago

2.0.0-dev.1427

1 year ago

2.0.0-dev.1426

1 year ago

2.0.0-dev.1425

1 year ago

2.0.0-dev.1424

1 year ago

2.0.0-dev.1548

1 year ago

2.0.0-dev.1528

1 year ago

2.0.0-dev.1516

1 year ago

2.0.0-dev.1518

1 year ago

2.0.0-dev.1517

1 year ago

2.0.0-dev.1515

1 year ago

2.0.0-dev.1510

1 year ago

2.12.0

1 year ago

2.11.0

2 years ago

2.10.1

2 years ago

2.10.2

2 years ago

2.10.0

2 years ago

2.10.3

2 years ago

2.9.3

2 years ago

2.9.2

2 years ago

2.9.1

2 years ago

2.8.4-nightly.0

2 years ago

2.9.0

2 years ago

2.8.1

3 years ago

2.8.3

2 years ago

2.8.2

3 years ago

2.8.0

3 years ago

2.7.0

3 years ago

2.6.1

3 years ago

2.6.2

3 years ago

2.6.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.5.0

3 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.2.1

3 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.0.0-rc.0

4 years ago

2.0.0-beta.3

4 years ago

2.0.0-beta.3.1

4 years ago

2.0.0-beta.2

4 years ago

2.0.0-beta.1

5 years ago

2.0.0-nightly.97

5 years ago

2.0.0-nightly.92

5 years ago

2.0.0-nightly.88

5 years ago

2.0.0-nightly.87

5 years ago

2.0.0-nightly.85

5 years ago

2.0.0-nightly.79

5 years ago

2.0.0-nightly.72

5 years ago

2.0.0-nightly.69

5 years ago

2.0.0-nightly.68

5 years ago

2.0.0-nightly.67

5 years ago

2.0.0-nightly.66

5 years ago

2.0.0-nightly.65

5 years ago

2.0.0-alpha.3.1

6 years ago

2.0.0-alpha.3

6 years ago

2.0.0-alpha.2.1

6 years ago

2.0.0-alpha.2

6 years ago

2.0.0-alpha.1.1

6 years ago

2.0.0-alpha.1

6 years ago