Skip to content

Commit

Permalink
should improve console output
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Mar 10, 2017
1 parent 165bc45 commit 65f11ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/rollup/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const {
replaceInternalModules,
getFbjsModuleAliases,
replaceFbjsModuleAliases,
getExternalModuleList,
} = require('./modules');
const {
bundles,
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 15 additions & 0 deletions scripts/rollup/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,26 @@ 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,
replaceInternalModules,
getInternalModules,
getFbjsModuleAliases,
replaceFbjsModuleAliases,
getExternalModuleList,
};

0 comments on commit 65f11ee

Please sign in to comment.