@@ -94,19 +94,6 @@ const isWatchMode = argv.watch;
94
94
const syncFBSourcePath = argv [ 'sync-fbsource' ] ;
95
95
const syncWWWPath = argv [ 'sync-www' ] ;
96
96
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
-
110
97
// Non-ES2015 stuff applied before closure compiler.
111
98
const babelPlugins = [
112
99
// These plugins filter out non-ES2015.
@@ -376,14 +363,24 @@ function getPlugins(
376
363
isUMDBundle && entry === 'react-art' && commonjs ( ) ,
377
364
// Apply dead code elimination and/or minification.
378
365
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
+ } ) ,
387
384
// HACK to work around the fact that Rollup isn't removing unused, pure-module imports.
388
385
// Note that this plugin must be called after closure applies DCE.
389
386
isProduction && stripUnusedImports ( pureExternalModules ) ,
0 commit comments