google / google/closure-compiler
Closure Compiler doesn't respect --emit_use_strict
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
The current version of Closure Compiler v20191111 doesn't respect --emit_use_strict option.
`java -jar closure-compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --strict_mode_input --language_out ECMASCRIPT3 --emit_use_strict --js cc_strict_test.js`
Expected behaviour: The command should generate a file beginning with the line: "use strict';
Actual behaviour: --emit_use_strict is ignored and the produced file doesn't begin with 'use strict";
According to the changelog of version v20170521 --emit_use_strict should be supported in combination with ES3:
> Allow --emit_use_strict flag to work in all language modes, including ES3.
But unfortunately this isn't the case. --emit_use_strict also does not work with other output language modes. For ECMASCRIPT5 we can instead use ECMASCRIPT5_STRICT as a workaround and newer language versions automatically enable Strict Mode (which can be disabled by using --emit_use_strict=false). For ES3 there are no such workarounds unfortunately.
Could you please fix this regression bug?
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.