Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jun 30, 2020
1 parent 85acb34 commit aa31eb3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion packages/babel-plugin-transform-runtime/src/index.js
Expand Up @@ -36,7 +36,10 @@ export default declare((api, options, dirname) => {

if (corejsVersion === 2) {
throw new Error(
"Since Babel 8, the core-js 2 support has been dropped. Please use 'corejs: 3'.",
`Since Babel 8, the core-js 2 support has been dropped. Please use 'corejs: 3'.
- If you really want to use obsolete core-js@2, please install \`babel-plugin-polyfill-corejs2\` and add to the "plugins" config
npm install --save-dev babel-plugin-polyfill-corejs2
yarn add --dev babel-plugin-polyfill-corejs2`,
);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/babel-preset-env/src/normalize-options.js
Expand Up @@ -249,7 +249,10 @@ export function normalizeCoreJSOption(
);
} else if (version.major === 2) {
throw new Error(
`Since Babel 8, the core-js@2 support has been dropped. Please use \`corejs: "3.6"\`.`,
`Since Babel 8, the core-js@2 support has been dropped. Please use \`corejs: "3.6"\`.
- If you really want to use obsolete core-js@2, please install \`babel-plugin-polyfill-corejs2\` and add to the "plugins" config
npm install --save-dev babel-plugin-polyfill-corejs2
yarn add --dev babel-plugin-polyfill-corejs2`,
);
}
}
Expand Down
10 changes: 5 additions & 5 deletions packages/babel-preset-env/test/normalize-options.spec.js
Expand Up @@ -90,11 +90,11 @@ describe("normalize-options", () => {
it("should throw removed option if corejs version is 2", () => {
[2, 2.1].forEach(corejs => {
["entry", "usage"].forEach(useBuiltIns => {
expect(() =>
normalizeOptions.default({ useBuiltIns, corejs }),
).toThrowError(
/Since Babel 8, the core-js@2 support has been dropped. Please use `corejs: "3.6"`/,
);
expect(() => normalizeOptions.default({ useBuiltIns, corejs }))
.toThrowError(`Since Babel 8, the core-js@2 support has been dropped. Please use \`corejs: "3.6"\`.
- If you really want to use obsolete core-js@2, please install \`babel-plugin-polyfill-corejs2\` and add to the "plugins" config
npm install --save-dev babel-plugin-polyfill-corejs2
yarn add --dev babel-plugin-polyfill-corejs2`);
});
});
});
Expand Down

0 comments on commit aa31eb3

Please sign in to comment.