diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index 377e241db3472..8ce406780573d 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -17,6 +17,7 @@ const { replaceInternalModules, getFbjsModuleAliases, replaceFbjsModuleAliases, + getExternalModuleList, } = require('./modules'); const { bundles, @@ -204,9 +205,7 @@ function createBundle({babelOpts, entry, fbEntry, config, paths, name, hasteName return rollup({ entry: bundleType === bundleTypes.FB ? fbEntry : entry, plugins: getPlugins(entry, babelOpts, paths, filename, bundleType), - external: [ - 'react', - ], + external: getExternalModuleList(), }).then(({write}) => write( updateBundleConfig(config, filename, format, bundleType, hasteName) )).catch(console.error); diff --git a/scripts/rollup/modules.js b/scripts/rollup/modules.js index 3f843b83a4612..6a0873402d310 100644 --- a/scripts/rollup/modules.js +++ b/scripts/rollup/modules.js @@ -151,6 +151,20 @@ function replaceFbjsModuleAliases(bundleType) { } } +function getExternalModuleList() { + // this is to stop Rollup spamming the console with warnings + return [ + 'react', + 'warning', + 'emptyFunction', + 'emptyObject', + 'react/lib/ReactCurrentOwner', + 'react/lib/checkPropTypes', + 'react/lib/ReactDebugCurrentFrame', + 'react/lib/ReactComponentTreeHook', + ]; +} + module.exports = { createModuleMap, getExternalModules, @@ -158,4 +172,5 @@ module.exports = { getInternalModules, getFbjsModuleAliases, replaceFbjsModuleAliases, + getExternalModuleList, };