@@ -353,7 +353,6 @@ function forbidFBJSImports() {
353353
354354function getPlugins (
355355 entry ,
356- unusedExternals ,
357356 updateBabelOptions ,
358357 filename ,
359358 packageName ,
@@ -537,18 +536,6 @@ function getPlugins(
537536 } ;
538537 } ,
539538 } ) ,
540- {
541- name : 'fail-with-unused-externals' ,
542- buildEnd ( error ) {
543- if ( ! error ) {
544- if ( unusedExternals . size > 0 ) {
545- throw new Error (
546- `${ entry } : You can remove these unused externals from the bundle entry: ${ [ ...unusedExternals ] } .`
547- ) ;
548- }
549- }
550- } ,
551- } ,
552539 ] . filter ( Boolean ) ;
553540 } catch ( error ) {
554541 console . error (
@@ -660,7 +647,6 @@ async function createBundle(bundle, bundleType) {
660647 ! isProductionBundleType ( bundleType )
661648 ) ;
662649
663- const unusedExternals = new Set ( bundle . externals ) ;
664650 const peerGlobals = Modules . getPeerGlobals ( bundle . externals , bundleType ) ;
665651 let externals = Object . keys ( peerGlobals ) ;
666652
@@ -682,7 +668,6 @@ async function createBundle(bundle, bundleType) {
682668 external ( id ) {
683669 const containsThisModule = pkg => id === pkg || id . startsWith ( pkg + '/' ) ;
684670 const isProvidedByDependency = externals . some ( containsThisModule ) ;
685- let isExternal ;
686671 if ( isProvidedByDependency ) {
687672 if ( id . indexOf ( '/src/' ) !== - 1 ) {
688673 throw Error (
@@ -695,20 +680,13 @@ async function createBundle(bundle, bundleType) {
695680 'to create a new bundle entry point for it instead.'
696681 ) ;
697682 }
698- isExternal = true ;
699- } else {
700- isExternal = ! ! peerGlobals [ id ] ;
701- }
702-
703- if ( isExternal ) {
704- unusedExternals . delete ( id ) ;
683+ return true ;
705684 }
706- return isExternal ;
685+ return ! ! peerGlobals [ id ] ;
707686 } ,
708687 onwarn : handleRollupWarning ,
709688 plugins : getPlugins (
710689 bundle . entry ,
711- unusedExternals ,
712690 bundle . babel ,
713691 filename ,
714692 packageName ,
0 commit comments