Repository: facebook/react
File: scripts/rollup/build.js (JavaScript)

Code before:

    return [
      // Keep dynamic imports as externals
      dynamicImports(),
      bundle.tsconfig != null
        ? typescript({tsconfig: bundle.tsconfig})
        : {
            name: 'rollup-plugin-flow-remove-types',
            transform(code) {
              const transformed = flowRemoveTypes(code);
              return {
                code: transformed.toString(),
                map: null,
              };
            },
          },
      // See https://github.com/rollup/plugins/issues/1425
      bundle.tsconfig != null ? commonjs({strictRequires: true}) : false,
      // Shim any modules that need forking in this environment.
      useForks(forks),
      // Ensure we don't try to bundle any fbjs modules.
      forbidFBJSImports(),
      // Use Node resolution mechanism.
      resolve({
        // skip: externals, // TODO: options.skip was removed in @rollup/plugin-node-resolve 3.0.0
        preferBuiltins: bundle.preferBuiltins,
      }),
      // Remove license headers from individual modules
      stripBanner({
        exclude: 'node_modules/**/*',
      }),
      // Compile to ES2015.
      babel(
        getBabelConfig(
          updateBabelOptions,
          bundleType,
          packageName,
          externals,
          !isProduction,
          bundle
        )
      ),
      // Remove 'use strict' from individual source files. We skip eslint-plugin-react-hooks because
      // it bundles compiler-type code that may examine "use strict" used outside of a directive
      // context, e.g. as a StringLiteral.
      bundle.name !== 'eslint-plugin-react-hooks'
        ? {
            name: "remove 'use strict'",
            transform(source) {
              return source.replace(/['"]use strict["']/g, '');
            },

Review comment (suggestion):
Started this PR before `bundle.preferBuiltins` was added. That's also a valid API (but should probably be `bundle.targetsNodeJS` or something). 

Code after:
      // Keep dynamic imports as externals
      dynamicImports(),
      bundle.tsconfig != null
        ? typescript({tsconfig: bundle.tsconfig})
        : {
            name: 'rollup-plugin-flow-remove-types',
            transform(code) {
              const transformed = flowRemoveTypes(code);
              return {
                code: transformed.toString(),
                map: null,
              };
            },
          },
      // See https://github.com/rollup/plugins/issues/1425
      bundle.tsconfig != null ? commonjs({strictRequires: true}) : false,
      // Shim any modules that need forking in this environment.
      useForks(forks),
      // Ensure we don't try to bundle any fbjs modules.
      forbidFBJSImports(),
      // Use Node resolution mechanism.
      resolve({
        // `external` rollup config takes care of marking builtins as externals
        preferBuiltins: false,
      }),
      // Remove license headers from individual modules
      stripBanner({
        exclude: 'node_modules/**/*',
      }),
      // Compile to ES2015.
      babel(
        getBabelConfig(
          updateBabelOptions,
          bundleType,
          packageName,
          !isProduction,
          bundle
        )
      ),
      // Remove 'use strict' from individual source files. We skip eslint-plugin-react-hooks because
      // it bundles compiler-type code that may examine "use strict" used outside of a directive
      // context, e.g. as a StringLiteral.
      bundle.name !== 'eslint-plugin-react-hooks'
        ? {
            name: "remove 'use strict'",
            transform(source) {
              return source.replace(/['"]use strict["']/g, '');
            },
          }
        : false,
      // Turn __DEV__ and process.env checks into constants.