closure-compiler icon indicating copy to clipboard operation
closure-compiler copied to clipboard

'rewrite_polyfills= false' is not working when language_out is present and below ECMASCRIPT_2017

Open icy0307 opened this issue 1 year ago • 2 comments

rewrite_polyfills= false still inject polyfills when language_out is below ECMASCRIPT_2017 for async function

step to reproduce

  1. echo 'export async function test(){console.log('test');}'> my_program.js
  2. npx google-closure-compiler --js=my_program.js --js_output_file=out.js --rewrite_polyfills=false --language_out=ECMASCRIPT_2015

async's polyfill is injected into the output. Should polyfills not be injected under any circumstances when rewrite_polyfills= false ?

icy0307 avatar Apr 03 '23 11:04 icy0307

I agree that it should use the Promise implementation (hopefully) available. Is the shipped polyfill maybe doing something special?

L3P3 avatar Jun 07 '23 21:06 L3P3

We are experiencing the same problem, affecting our production users on version google-closure-compiler: 20240317.0.0. as it was working in our previous version 20180805.0.0

Why is this flag no longer working? We don't want the compiler to inject polyfill if we have enabled the flag independently of the language_out.

Our configuration

--platform native
--compilation_level SIMPLE
--language_in ECMASCRIPT5_STRICT
--language_out ECMASCRIPT3
--json_streams OUT
--assume_function_wrapper
--rewrite_polyfills false
--isolate_polyfills
--warning_level QUIET
--externs ${externsJs.path}

eduardoacskimlinks avatar May 29 '24 13:05 eduardoacskimlinks