Open nicolo-ribaudo opened 4 years ago
Yes thanks, we are a few years late with this release! 🙃
(If it takes another year we can also drop Node.js 14 👀)
I guess Node 14 support can be dropped...
Now that 8 would be released in 2023, could dropping Flow, IE, and pre-ES2015 support be done?
Before this is out the gate, Node 16 will be well passed it's EOL as well https://nodejs.org/en/blog/announcements/nodejs16-eol
Thanks for the reminder :)
Once https://github.com/babel/babel/pull/16416, https://github.com/babel/babel/issues/16443 and https://github.com/babel/babel/issues/16456 are done I plan to release a Babel 8.0.0-beta.0 version
typescript-eslint
made some changes to their AST, blog post, do we have a plan to align with it in v8?
Whoever may be concerned by this: will Babel 8
see the light of day anytime soon?
Pinging @nicolo-ribaudo specifically as he is author of this issue.
@nicolo-ribaudo
Previously, the move of replacing chalk
was abandoned years ago: https://github.com/babel/babel/pull/13783
Since you had approved that PR, would you be interested in landing this in Babel 8? I could open a PR for this.
We plan to release a new major version in 2024 (milestone).
This release won't have all the migration pain which there was while migrating from Babel 5 to Babel 6 and then from Babel 6 to Babel 7. We plan to only make a few breaking changes, and provide an easy migration strategy for each of them. Because of this, you won't see ~80 prereleases like we did in for Babel 7.0.0, but we plan to only release a few of them.
Babel 8.0.0 will only contain breaking changes: we will release a minor version the same day, containing all the bug fixes and new features that would otherwise be released in 8.0.0.
This document is still a work in progress, but you can already start by applying the suggested migration strategies to your own codebase.
Note for maintainers: release workflow
1. Locally checkout the `main` branch 2. Run `make new-babel-8-version`, which will: - Compute the new prerelease version, by adding 1 to the prerelease number in `package.json#version_babel8` - Update `package.json#version_babel8`, and commit it to `main` - Create a new `release/${version}` branch - Run `yarn release-tool version ${version} --all` in that branch, to update the version of every package to the new pre-release 3. Push `main`, `release/${version}` and the new `v${release}` tag to `babel/babel` Then, the `release` GH workflow will start running on the new tag and publish it to npm.Compilation breaking changes
[x] Don't remove uninitialized class fields when using Flow/TS (pr for flow: #10120, pr for TS: #11114)
Area: Flow and TypeScript transforms
Impact: High (only for flow and TypeScript users)
Migration: You can use the new
declare
syntax, introduced in TypeScript 3.7 (Babel 7.7) and in Flow 0.120 (Babel 7.9), if you don't want fields to be initialized toundefined
:Note that while this syntax is enabled by default in
@babel/parser
when using thetypescript
orflow
plugins, if you are using Babel to remove type annotations you must enable theallowDeclareFields
option:[x] Disallow sequence expressions inside JSX attributes (pr: #8787)
Area: JSX,
@babel/parser
Impact: Low
Migration: If you are using them, you can already wrap them in parentheses:
[x] Disallow
}
and>
in JSX text (pr: https://github.com/babel/babel/pull/11046)Area:
@babel/parser
with JSXImpact: Low
Migration: You can use
{'}'}
and{'>'}
instead.Notes: This is technically a bug fix becase the specification already forbids them. However, we have chosen to postpone it until Babel 8 because it could break someone's code.
[x] Transforms JSX spread properties using object spread (pr: #11141, docs: website#2289)
Area: JSX
Impact: Medium
Migration: You can already have this behavior by using the
useSpread
option in Babel 7.7.0. If your code needs to run in an environment which doesn't support object spread, you can either use@babel/preset-env
(recommended) or@babel/plugin-proposal-object-rest-spread
. If you want to transpileObject.assign
down to Babel's_extends
helper (which is the current default behavior) you also need to enable@babel/plugin-transform-object-assign
.[x] Use the new JSX implementation by default (pr: #11436, docs: website#2289)
Area: JSX
Impact: High
Migration: Starting from Babel 7.9.0, you can pass the
runtime: "classic"
option to@babel/preset-react
or@babel/plugin-transform-react-jsx
to be explicit about your usage ofcreateElement
(or the equivalent function in other libraries). If you are using a modern enough version of React or Preact, you can already use the newruntime: "automatic"
implementation.[x] Parse JSX elements when both the JSX and TS plugins are enabled, and throw an error when both Flow and TS are enabled (pr: #11316)
Area: JSX, TypeScript
Impact: Low
Migration: If you don't want
<Foo>
to be parsed as a JSX element, but as a TypeScript typecast, you can disable the JSX plugin.Note: The current behavior is that JSX parsing is only handled by the
isTSX
option of the TypeScript plugin. We are also removing this option. We think that having the JSX plugin control JSX parsing is less confusing for our users.[x] Remove
moduleAttributes
support (pr: #13308)Area: Import assertions ES proposal
Impact: Low
Migration: Replace
@babel/plugin-syntax-module-attributes
by@babel/plugin-syntax-import-assertions
: you can already start doing this in Babel 7. After you replace the plugin, you should search the following patterns in your codebaseand replace them by
If you are not using
@babel/plugin-syntax-module-attributes
, you don't need to do anything.[x] Remove support for the 2018-09 decorators proposal (pr: #12712)
Area:
@babel/plugin-proposal-decorators
Impact: Medium
Migration: You should migrate to the new version of the proposal. The syntax is the same, but you will need to rewrite your decorator functions. You can already migrate since Babel 7.17.0, using the
"version": "2021-12"
option of@babel/plugin-proposal-decorators
.Configuration breaking changes
@babel/plugin-proposal-dynamic-import
when transformingimport()
to SystemJS (#12700)@babel/plugin-transform-modules-systemjs
@babel/plugin-proposal-dynamic-import
to your config: you can already do it in Babel 7. If you are using@babel/preset-env
, you don't need to do anything.transform-modules-commonjs
andtransform-modules-amd
) require the separate plugin since it was introduced. We couldn't change it fortransform-modules-systemjs
because that package did already support dynamic import.defaults, not ie 11
as default targets@babel/preset-env
targets
or have a.browserslist
config file, this change won't affect you. Otherwise, you'll probably be fine with the new behavior (which supports these modern browsers). Note that the default targets does not include IE. If you still need to support IE, please specifyIE 11
intargets
. If you need to enable every possible plugin for even older browsers, you can already enable theforceAllTransforms
option.uglify
target (pr: #10895, docs: website#2290)@babel/preset-env
uglifyjs
target had been deprecated since 7.0.0-beta.0, if you still need this, you can enable theforceAllTransforms
option.@babel/core
,@babel/cli
,@babel/plugin-transform-modules-amd
,@babel/plugin-transform-modules-umd
,@babel/plugin-transform-modules-systemjs
core-js
2 (pr: #11751)@babel/preset-env
,@babel/plugin-transform-runtime
,@babel/compat-data
core-js@3
. Don't forget tonpm install
it!useBuiltIns
is enabled, the defaultcore-js
version is now3.6
instead of2
core-js@2
support, you can usebabel-plugin-polyfill-core-js2
.version
option to thedecorators
plugins, and merge the two plugins in@babel/parser
.@babel/preset-typescript
,@babel/preset-flow
,@babel/plugin-transform-typescript
,@babel/plugin-transform-flow-strip-types
overrides
option (this is not necessary if you are using the presets, and not directly the plugins)isTSX
option from@babel/preset-typescript
and instead enable the relevant JSX preset/plugin.API breaking changes
babel.transform
,babel.transformFile
,babel.transformFromAst
,babel.parse
,babel.loadOptions
andbabel.loadPartialConfig
synchronously (pr: #11110, #12695)@babel/core
babel.transformSync
,babel.transformFromAstSync
andbabel.transformFileSync
, supported since version 7.0.0.babel.parseSync
,babel.loadOptionsSync
andbabel.loadPartialConfigSync
will be introduced in v7.8.0.TSParenthesizedType
unlesscreateParenthesizedExpression
is enabled (pr: #11200)@babel/parser
createParenthesizedExpression
parser option (supported since Babel 7.4.0)t.jSX*
andt.tS*
builder aliases (pr: #6993)@babel/types
t.jsx*
andt.ts*
instead, which have been supported since Babel 7.0.0t.identifier
builder (#10917)@babel/types
metro
bundler as of Nov 2019 (#10645)jsonCompatibleStrings
generator option (pr: #9958)@babel/generator
@babel/generator
allows to specify options for jsesc, the library used to escape printed values. If you are using thejsonCompatibleStrings
option, you can replace it withjsescOption: { json: true }
.useBuiltIns: 0
when transforming JSX (pr: #12460, #12741, #12751)@babel/plugin-transform-react-jsx
,@babel/preset-env
useBuiltIns: false
instead.AST breaking changes
TSTypeParameter.name
(#12829)@babel/parser
TSTypeParameter
, e.g. theT
infunction f<T>() {}
node
,node.name
is a string in Babel 7 while in Babel 8 it is anIdentifier
name
of a type parameternode
, usenode.name.name
in Babel 8.parameters
toparams
,typeAnnotation
toreturnType
forTSCallSignatureDeclaration
,TSConstructSignatureDeclaration
,TSFunctionType
,TSConstructorType
andTSMethodSignature
(#9231) (pr: #13709)@babel/parser
Impact: High for customized Babel plugin depending on these TS nodes:
// TSFunctionType type Bar =() => string;
// TSConstructorType type Baz = new() => string;
Misc breaking changes
@babel/core
to^8.0.0
@babel/*
package"type": "module"
)@babel/runtime
,@babel/runtime-corejs2
,@babel/runtime-corejs3
.js
modules don't work with nativeimport
unless ourpackage.json
specifiestype: "module"
(which will break cjs helpers).@babel/runtime
@babel/runtime
,@babel/runtime-corejs2
,@babel/runtime-corejs3
@babel/runtime
7.x with@babel/plugin-transform-runtime
8.x (or the other way around), which woudln't be supported anyway.vue-cli
(cc @sodatea) andember-cli-babel
[2] (cc @rwjblue). We will providetargets-parser
as a separate helper in v7.8.0. :warning: If anyone else is relying on internal Babel files, please let us know!@babel/generator
babel.transform
API and your server is not serving js files in theutf8
encoding.@babel/cli
, WebPack, Rollup, create-react-app or other Node.js powered bundlers, the transformed code is always encoded withutf-8
. That said, this issue probably won't affect your app.utf8
encoding. If you can not control the server output, use<script charset="utf-8" src="your-app.js"></script>
in the html files. You may also restore to the Babel 7 behaviour by@babel/parser
error.code
isOptionalBindingPattern
.error.code
forOptionalBindingPattern
is renamed asPatternIsOptional
.Other possibly breaking changes
@babel/plugin-transform-typescript
NodePath
s to be requeued (pr: #13291)@babel/traverse
@babel/plugin-transform-block-scoping
Related: https://github.com/babel/babel/issues/10752
Note for contributors
~~We implement Babel 8 breaking changes under the
BABEL_8_BREAKING
env flag. To test the breaking changes, please duplicate the affected tests with the-babel-7
suffix and addBABEL_8_BREAKING: false
to test options. The breaking changes will be merged to themain
branch but stripped before publishing. ~~