Don't build non-experimental www bundles (#17139)
Reduces the likelihood we'll accidentally sync the wrong ones.
Andrew Clark committed
Oct 18, 2019 at 14:36 UTC
7082d5a2db5c1e5f49a62aecd90b6858f957da5e
2 files changed
+21
-14
scripts/rollup/build.js
+14
-10
@@ -25,6 +25,8 @@ const {asyncCopyTo, asyncRimRaf} = require('./utils');
25
const codeFrame = require('babel-code-frame');
26
const Wrappers = require('./wrappers');
27
28
+const __EXPERIMENTAL__ = process.env.RELEASE_CHANNEL === 'experimental';
29
+
30
// Errors in promises should be fatal.
31
let loggedErrors = new Set();
32
process.on('unhandledRejection', err => {
@@ -304,8 +306,7 @@ function getPlugins(
306
bundleType,
307
globalName,
308
moduleType,
307
- pureExternalModules,
308
- isExperimentalBuild
309
+ pureExternalModules
310
) {
311
const findAndRecordErrorCodes = extractErrorCodes(errorCodeOpts);
312
const forks = Modules.getForks(bundleType, entry, moduleType);
@@ -363,7 +364,7 @@ function getPlugins(
364
__PROFILE__: isProfiling || !isProduction ? 'true' : 'false',
365
__UMD__: isUMDBundle ? 'true' : 'false',
366
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
366
- __EXPERIMENTAL__: isExperimentalBuild,
367
+ __EXPERIMENTAL__,
368
}),
369
// We still need CommonJS for external deps like object-assign.
370
commonjs(),
@@ -487,8 +488,6 @@ async function createBundle(bundle, bundleType) {
488
module => !importSideEffects[module]
489
);
490
490
- const isExperimentalBuild = process.env.RELEASE_CHANNEL === 'experimental';
491
-
491
const rollupConfig = {
492
input: resolvedEntry,
493
treeshake: {
@@ -512,8 +511,7 @@ async function createBundle(bundle, bundleType) {
511
bundleType,
512
bundle.global,
513
bundle.moduleType,
515
- pureExternalModules,
516
- isExperimentalBuild
514
+ pureExternalModules
515
),
516
// We can't use getters in www.
517
legacy:
@@ -656,9 +654,6 @@ async function buildEverything() {
654
[bundle, NODE_DEV],
655
[bundle, NODE_PROD],
656
[bundle, NODE_PROFILING],
659
- [bundle, FB_WWW_DEV],
660
- [bundle, FB_WWW_PROD],
661
- [bundle, FB_WWW_PROFILING],
657
[bundle, RN_OSS_DEV],
658
[bundle, RN_OSS_PROD],
659
[bundle, RN_OSS_PROFILING],
@@ -666,6 +661,15 @@ async function buildEverything() {
661
[bundle, RN_FB_PROD],
662
[bundle, RN_FB_PROFILING]
663
);
664
+
665
+ if (__EXPERIMENTAL__) {
666
+ // www uses experimental builds only.
667
+ bundles.push(
668
+ [bundle, FB_WWW_DEV],
669
+ [bundle, FB_WWW_PROD],
670
+ [bundle, FB_WWW_PROFILING]
671
+ );
672
+ }
673
}
674
675
if (!shouldExtractErrors && process.env.CIRCLE_NODE_TOTAL) {
scripts/rollup/validate/index.js
+7
-4
@@ -54,10 +54,6 @@ function checkFilesExist(bundle) {
54
}
55
56
const bundles = [
57
- {
58
- format: 'fb',
59
- filePatterns: [`./build/facebook-www/*.js`],
60
- },
57
{
58
format: 'rn',
59
filePatterns: [`./build/react-native/implementations/*.js`],
@@ -75,4 +71,11 @@ const bundles = [
71
},
72
];
73
74
+if (process.env.RELEASE_CHANNEL === 'experimental') {
75
+ bundles.push({
76
+ format: 'fb',
77
+ filePatterns: [`./build/facebook-www/*.js`],
78
+ });
79
+}
80
+
81
bundles.map(checkFilesExist).map(lint);