Open aalbert-specialtys opened 2 years ago
I am experiencing this same issue. We have TypeScript files being rendered to .js files, then we use WebOptimizer to bundle those JS files, while also minifying all those files. After including the generated bundled and minified file on our site, we immediately start getting the following error in the console:
Uncaught SyntaxError: Lexical declaration cannot appear in a single-statement context
Note that this also began occurring after we set "target": "ES6"
in our tsconfig.json file.
Is there any way to fix this? We'd like to use WebOptimizer, but can't without a fix for this.
Currently using latest version v3.0.368 with .net 6
The minifier produces invalid JS syntax from valid source. The chrome browser console displays the following error: "Lexical declaration cannot appear in a single-statement context". This bug breaks browser parsing and the whole file is ignored.
Here is an excerpt of the offending input and output:
Source
Output
The problem is that
let
must be contained in a block{ }
. I would appreciate help fixing this