Unverified Commit a1ea3529 authored by Guy Bedford's avatar Guy Bedford Committed by GitHub

Remove @babel/preset-modules (#18759)

This is a prerequisite to being able to ncc inline the Babel dependencies in next.js.

The removal of preset-modules is based on replacing it with preset-env under `targets: { esmodules: true }`, as per the guidance from the package (https://www.npmjs.com/package/@babel/preset-modules):

> Starting from @babel/preset-env 7.9.0, you can enable the bugfixes: true option to get the same behavior as using @babel/preset-modules, but with support for custom targets. If you need to target browsers with native modules support (like this preset does), you can use targets: { esmodules: true }.

From the above, I'm pretty sure this is entirely a backwards compatible change, apart from the change to the runtime plugin list being visible. Perhaps @developit can confirm this as well.
parent 5ecdcab6
...@@ -164,8 +164,12 @@ export class NextEsmPlugin implements Plugin { ...@@ -164,8 +164,12 @@ export class NextEsmPlugin implements Plugin {
if (IS_PRESET_ENV.test(name)) { if (IS_PRESET_ENV.test(name)) {
presets.push([ presets.push([
require.resolve('@babel/preset-modules'), require.resolve('@babel/preset-env'),
{ loose: true }, {
bugfixes: true,
loose: true,
targets: { esmodules: true },
},
]) ])
} else { } else {
presets.push([name, opts]) presets.push([name, opts])
......
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
"@babel/plugin-transform-modules-commonjs": "7.10.4", "@babel/plugin-transform-modules-commonjs": "7.10.4",
"@babel/plugin-transform-runtime": "7.11.5", "@babel/plugin-transform-runtime": "7.11.5",
"@babel/preset-env": "7.11.5", "@babel/preset-env": "7.11.5",
"@babel/preset-modules": "0.1.4",
"@babel/preset-react": "7.10.4", "@babel/preset-react": "7.10.4",
"@babel/preset-typescript": "7.10.4", "@babel/preset-typescript": "7.10.4",
"@babel/runtime": "7.11.2", "@babel/runtime": "7.11.2",
......
...@@ -1355,17 +1355,6 @@ ...@@ -1355,17 +1355,6 @@
"@babel/helper-plugin-utils" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-transform-flow-strip-types" "^7.10.4" "@babel/plugin-transform-flow-strip-types" "^7.10.4"
"@babel/preset-modules@0.1.4":
version "0.1.4"
resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.4.tgz#362f2b68c662842970fdb5e254ffc8fc1c2e415e"
integrity sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-proposal-unicode-property-regex" "^7.4.4"
"@babel/plugin-transform-dotall-regex" "^7.4.4"
"@babel/types" "^7.4.4"
esutils "^2.0.2"
"@babel/preset-modules@^0.1.3": "@babel/preset-modules@^0.1.3":
version "0.1.3" version "0.1.3"
resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.3.tgz#13242b53b5ef8c883c3cf7dddd55b36ce80fbc72" resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.3.tgz#13242b53b5ef8c883c3cf7dddd55b36ce80fbc72"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment