in scripts/rollup/packaging.js [48:117]
function getBundleOutputPath(bundle, bundleType, filename, packageName) {
switch (bundleType) {
case NODE_ES2015:
return `build/node_modules/${packageName}/cjs/${filename}`;
case NODE_ESM:
return `build/node_modules/${packageName}/esm/${filename}`;
case BUN_DEV:
case BUN_PROD:
return `build/node_modules/${packageName}/cjs/${filename}`;
case NODE_DEV:
case NODE_PROD:
case NODE_PROFILING:
return `build/node_modules/${packageName}/cjs/${filename}`;
case UMD_DEV:
case UMD_PROD:
case UMD_PROFILING:
return `build/node_modules/${packageName}/umd/${filename}`;
case FB_WWW_DEV:
case FB_WWW_PROD:
case FB_WWW_PROFILING:
return `build/facebook-www/${filename}`;
case RN_OSS_DEV:
case RN_OSS_PROD:
case RN_OSS_PROFILING:
switch (packageName) {
case 'react-native-renderer':
return `build/react-native/implementations/${filename}`;
default:
throw new Error('Unknown RN package.');
}
case RN_FB_DEV:
case RN_FB_PROD:
case RN_FB_PROFILING:
switch (packageName) {
case 'scheduler':
case 'react':
case 'react-is':
case 'react-test-renderer':
return `build/facebook-react-native/${packageName}/cjs/${filename}`;
case 'react-native-renderer':
return `build/react-native/implementations/${filename.replace(
/\.js$/,
'.fb.js'
)}`;
case 'react-server-native-relay':
return `build/facebook-relay/flight/${filename}`;
default:
throw new Error('Unknown RN package.');
}
case BROWSER_SCRIPT: {
// Bundles that are served as browser scripts need to be able to be sent
// straight to the browser with any additional bundling. We shouldn't use
// a module to re-export. Depending on how they are served, they also may
// not go through package.json module resolution, so we shouldn't rely on
// that either. We should consider the output path as part of the public
// contract, and explicitly specify its location within the package's
// directory structure.
const outputPath = bundle.outputPath;
if (!outputPath) {
throw new Error(
'Bundles with type BROWSER_SCRIPT must specific an explicit ' +
'output path.'
);
}
return `build/node_modules/${packageName}/${outputPath}`;
}
default:
throw new Error('Unknown bundle type.');
}
}