should fix fb and cjs bundles for ReactCurrentOwner

This commit is contained in:
Dominic Gannaway
2017-03-10 13:51:28 +00:00
parent c4dfd17c59
commit ccfefc8a17
3 changed files with 53 additions and 19 deletions
+6 -1
View File
@@ -147,7 +147,12 @@ function getCommonJsConfig(bundleType) {
// ],
// };
// change of plan: let's bundle them again
return {};
return {
ignore: [
'react/lib/ReactCurrentOwner',
'ReactCurrentOwner',
],
};
}
}
+17 -6
View File
@@ -6,14 +6,25 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCurrentOwner
* @flow
*
*/
'use strict';
const {
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
} = require('React-fb');
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
/**
* @internal
* @type {ReactComponent}
*/
current: null,
};
module.exports = ReactCurrentOwner;
+30 -12
View File
@@ -40,18 +40,35 @@ function getExternalModules(bundleType) {
}
}
function getInternalModules() {
return {
// we tell Rollup where these files are located internally, otherwise
// it doesn't pick them up and assumes they're external
reactProdInvariant: resolve('./src/shared/utils/reactProdInvariant.js'),
'ReactCurrentOwner': resolve('./src/isomorphic/classic/element/ReactCurrentOwner.js'),
'ReactComponentTreeHook': resolve('./src/isomorphic/hooks/ReactComponentTreeHook.js'),
'react/lib/ReactCurrentOwner': resolve('./src/isomorphic/classic/element/ReactCurrentOwner.js'),
'react/lib/checkPropTypes': resolve('./src/isomorphic/classic/types/checkPropTypes.js'),
'react/lib/ReactDebugCurrentFrame': resolve('./src/isomorphic/classic/element/ReactDebugCurrentFrame.js'),
'react/lib/ReactComponentTreeHook': resolve('./src/isomorphic/hooks/ReactComponentTreeHook.js'),
};
function getInternalModules(bundleType) {
switch (bundleType) {
case bundleTypes.DEV:
case bundleTypes.PROD:
return {
// we tell Rollup where these files are located internally, otherwise
// it doesn't pick them up and assumes they're external
'ReactCurrentOwner': resolve('./src/isomorphic/classic/element/ReactCurrentOwner.js'),
'react/lib/ReactCurrentOwner': resolve('./src/isomorphic/classic/element/ReactCurrentOwner.js'),
//
reactProdInvariant: resolve('./src/shared/utils/reactProdInvariant.js'),
'ReactComponentTreeHook': resolve('./src/isomorphic/hooks/ReactComponentTreeHook.js'),
'react/lib/checkPropTypes': resolve('./src/isomorphic/classic/types/checkPropTypes.js'),
'react/lib/ReactDebugCurrentFrame': resolve('./src/isomorphic/classic/element/ReactDebugCurrentFrame.js'),
'react/lib/ReactComponentTreeHook': resolve('./src/isomorphic/hooks/ReactComponentTreeHook.js'),
};
case bundleTypes.NODE:
case bundleTypes.FB:
return {
// we tell Rollup where these files are located internally, otherwise
// it doesn't pick them up and assumes they're external
reactProdInvariant: resolve('./src/shared/utils/reactProdInvariant.js'),
'ReactComponentTreeHook': resolve('./src/isomorphic/hooks/ReactComponentTreeHook.js'),
'react/lib/checkPropTypes': resolve('./src/isomorphic/classic/types/checkPropTypes.js'),
'react/lib/ReactDebugCurrentFrame': resolve('./src/isomorphic/classic/element/ReactDebugCurrentFrame.js'),
'react/lib/ReactComponentTreeHook': resolve('./src/isomorphic/hooks/ReactComponentTreeHook.js'),
};
}
}
function replaceInternalModules(bundleType) {
@@ -128,6 +145,7 @@ function replaceFbjsModuleAliases(bundleType) {
'fbjs/lib/ExecutionEnvironment': 'ExecutionEnvironment',
'fbjs/lib/createNodesFromMarkup': 'createNodesFromMarkup',
'fbjs/lib/performanceNow': 'performanceNow',
'react/lib/ReactCurrentOwner': 'ReactCurrentOwner',
"'react'": "'React'",
};
}