Skip to content

Commit 6c1485e

Browse files
committed
Set BUNDLE_SCRIPT's GCC output format to ES5
This removes the automatic 'use strict' directive, which we don't need.
1 parent 054141f commit 6c1485e

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

scripts/rollup/build.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,6 @@ const isWatchMode = argv.watch;
9494
const syncFBSourcePath = argv['sync-fbsource'];
9595
const syncWWWPath = argv['sync-www'];
9696

97-
const closureOptions = {
98-
compilation_level: 'SIMPLE',
99-
language_in: 'ECMASCRIPT_2015',
100-
language_out: 'ECMASCRIPT5_STRICT',
101-
env: 'CUSTOM',
102-
warning_level: 'QUIET',
103-
apply_input_source_maps: false,
104-
use_types_for_optimization: false,
105-
process_common_js_modules: false,
106-
rewrite_polyfills: false,
107-
inject_libraries: false,
108-
};
109-
11097
// Non-ES2015 stuff applied before closure compiler.
11198
const babelPlugins = [
11299
// These plugins filter out non-ES2015.
@@ -376,14 +363,24 @@ function getPlugins(
376363
isUMDBundle && entry === 'react-art' && commonjs(),
377364
// Apply dead code elimination and/or minification.
378365
isProduction &&
379-
closure(
380-
Object.assign({}, closureOptions, {
381-
// Don't let it create global variables in the browser.
382-
// https://github.com/facebook/react/issues/10909
383-
assume_function_wrapper: !isUMDBundle,
384-
renaming: !shouldStayReadable,
385-
})
386-
),
366+
closure({
367+
compilation_level: 'SIMPLE',
368+
language_in: 'ECMASCRIPT_2015',
369+
language_out:
370+
bundleType === BROWSER_SCRIPT ? 'ECMASCRIPT5' : 'ECMASCRIPT5_STRICT',
371+
env: 'CUSTOM',
372+
warning_level: 'QUIET',
373+
apply_input_source_maps: false,
374+
use_types_for_optimization: false,
375+
process_common_js_modules: false,
376+
rewrite_polyfills: false,
377+
inject_libraries: false,
378+
379+
// Don't let it create global variables in the browser.
380+
// https://github.com/facebook/react/issues/10909
381+
assume_function_wrapper: !isUMDBundle,
382+
renaming: !shouldStayReadable,
383+
}),
387384
// HACK to work around the fact that Rollup isn't removing unused, pure-module imports.
388385
// Note that this plugin must be called after closure applies DCE.
389386
isProduction && stripUnusedImports(pureExternalModules),

0 commit comments

Comments
 (0)