{"id":"cb0c4075a458305c","repo":"babel/babel","slug":"ispluginrequired-has-been-removed-in-babel-8-pl","errorCode":null,"errorMessage":"`isPluginRequired` has been removed in Babel 8. Please use `isRequired` from `@babel/helper-compilation-targets` instead.","messagePattern":"`isPluginRequired` has been removed in Babel 8\\. Please use `isRequired` from `@babel/helper-compilation-targets` instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/babel-preset-env/src/index.ts","lineNumber":41,"sourceCode":"import pluginCoreJS3 from \"babel-plugin-polyfill-corejs3\";\n\nimport getTargets, {\n  prettifyTargets,\n  filterItems,\n} from \"@babel/helper-compilation-targets\";\nimport type { Targets } from \"@babel/helper-compilation-targets\";\nimport availablePlugins from \"./available-plugins.ts\";\nimport { declarePreset } from \"@babel/helper-plugin-utils\";\n\nimport type { BuiltInsOption, ModuleOption, Options } from \"./types.d.ts\";\nexport type { Options };\n\n/**\n * @deprecated Use `isRequired` from `@babel/helper-compilation-targets` instead.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function isPluginRequired(targets: Targets, support: Targets) {\n  throw new Error(\n    \"`isPluginRequired` has been removed in Babel 8. Please use `isRequired` from `@babel/helper-compilation-targets` instead.\",\n  );\n}\n\nfunction filterStageFromList(\n  list: Record<string, Targets>,\n  stageList: Set<string>,\n) {\n  return Object.keys(list).reduce((result, item) => {\n    if (!stageList.has(item)) {\n      // @ts-expect-error todo: refine result types\n      result[item] = list[item];\n    }\n\n    return result;\n  }, {});\n}\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/babel/babel/blob/06b6eae39da4ce0689fad64e2c48a6375a464208/packages/babel-preset-env/src/index.ts#L23-L59","documentation":"@babel/preset-env still exports `isPluginRequired` for backwards compatibility, but its body (index.ts:40-44) unconditionally throws. In Babel 8 the capability moved to `@babel/helper-compilation-targets` as `isRequired`, so any call to the old export is dead code.","triggerScenarios":"Importing `{ isPluginRequired }` from `@babel/preset-env` and invoking it: `isPluginRequired(targets, support)`.","commonSituations":"Build scripts, CLIs, or codemods that computed whether a transform was needed via preset-env's old export and were never migrated during the Babel 8 upgrade.","solutions":["Replace the import: `import { isRequired } from '@babel/helper-compilation-targets'`.","Call `isRequired(targets, pluginCompatData)` with the same two-argument shape."],"exampleFix":"// before\nimport { isPluginRequired } from \"@babel/preset-env\";\nisPluginRequired(targets, { chrome: \"60\" });\n// after\nimport { isRequired } from \"@babel/helper-compilation-targets\";\nisRequired({ chrome: \"60\" }, pluginCompat);","handlingStrategy":"validation","validationCode":"// do not import isPluginRequired from @babel/preset-env\nimport { isRequired } from \"@babel/helper-compilation-targets\";","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Grep the codebase for `isPluginRequired` immediately after upgrading.","Switch to `isRequired` from `@babel/helper-compilation-targets` proactively."],"tags":["babel-8","preset-env","deprecated","migration"],"analyzedSha":"06b6eae39da4ce0689fad64e2c48a6375a464208","analyzedAt":"2026-08-03T20:13:43.465Z","schemaVersion":2}