Skip to content

Commit 71f8787

Browse files
Clarify warning source about underspecified corejs option in preset-env. (#12402)
* Clarify these warnings are for babel-preset-env. * Fix lint. * Fix specs. * Fix merge conflict. * PR feedback.
1 parent 4b79ab4 commit 71f8787

File tree

10 files changed

+44
-18
lines changed

10 files changed

+44
-18
lines changed

packages/babel-preset-env/src/normalize-options.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function normalizeCoreJSOption(
160160
if (useBuiltIns && corejs === undefined) {
161161
rawVersion = 2;
162162
console.warn(
163-
"\nWARNING: We noticed you're using the `useBuiltIns` option without declaring a " +
163+
"\nWARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a " +
164164
"core-js version. Currently, we assume version 2.x when no version " +
165165
"is passed. Since this default version will likely change in future " +
166166
"versions of Babel, we recommend explicitly setting the core-js version " +
@@ -170,7 +170,9 @@ export function normalizeCoreJSOption(
170170
"`dependencies` section. If it doesn't, you need to run one of the " +
171171
"following commands:\n\n" +
172172
" npm install --save core-js@2 npm install --save core-js@3\n" +
173-
" yarn add core-js@2 yarn add core-js@3\n",
173+
" yarn add core-js@2 yarn add core-js@3\n\n" +
174+
"More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins\n" +
175+
"More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs",
174176
);
175177
} else if (typeof corejs === "object" && corejs !== null) {
176178
rawVersion = corejs.version;
@@ -183,7 +185,7 @@ export function normalizeCoreJSOption(
183185

184186
if (!useBuiltIns && version) {
185187
console.log(
186-
"\nThe `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n",
188+
"\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n",
187189
);
188190
}
189191

packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The `corejs` option only has an effect when the `useBuiltIns` option is not `false`
1+
WARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`
22

33
@babel/preset-env: `DEBUG` option
44

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
6-
yarn add core-js@2 yarn add core-js@3
6+
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
6-
yarn add core-js@2 yarn add core-js@3
6+
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
6-
yarn add core-js@2 yarn add core-js@3
6+
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
6-
yarn add core-js@2 yarn add core-js@3
6+
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
66
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
66
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
6-
yarn add core-js@2 yarn add core-js@3
6+
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
1+
WARNING (@babel/preset-env): We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
22

33
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
44

55
npm install --save core-js@2 npm install --save core-js@3
6-
yarn add core-js@2 yarn add core-js@3
6+
yarn add core-js@2 yarn add core-js@3
7+
8+
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
9+
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs

0 commit comments

Comments
 (0)