[babel 8] Type checking preset-react options (#12741)

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
Huáng Jùnliàng
2021-03-26 15:11:39 -04:00
committed by GitHub
parent e68f2ce195
commit 1e3ef05685
7 changed files with 290 additions and 47 deletions

View File

@@ -288,11 +288,18 @@ function buildRollup(packages, targetBrowsers) {
input,
external,
onwarn(warning, warn) {
if (warning.code !== "CIRCULAR_DEPENDENCY") {
if (warning.code === "CIRCULAR_DEPENDENCY") return;
if (warning.code === "UNUSED_EXTERNAL_IMPORT") {
warn(warning);
// https://github.com/babel/babel/pull/12011#discussion_r540434534
throw new Error("Rollup aborted due to warnings above");
return;
}
// We use console.warn here since it prints more info than just "warn",
// in case we want to stop throwing for a specific message.
console.warn(warning);
// https://github.com/babel/babel/pull/12011#discussion_r540434534
throw new Error("Rollup aborted due to warnings above");
},
plugins: [
rollupBabelSource(),
@@ -424,6 +431,7 @@ function copyDts(packages) {
const libBundles = [
"packages/babel-parser",
"packages/babel-plugin-proposal-optional-chaining",
"packages/babel-preset-react",
"packages/babel-preset-typescript",
"packages/babel-helper-member-expression-to-functions",
"packages/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining",