gruntjs / grunt-contrib-uglify

Minify files with UglifyJS.
http://gruntjs.com/
MIT License
1.48k stars 347 forks source link

Unexpected token: name «fetch» #571

Open kmgdevelopment opened 2 years ago

kmgdevelopment commented 2 years ago

If I try to use fetch like so:

let response = await fetch('https://domain.tld');

Uglify throws this error:

Unexpected token: name «fetch», expected: punc «;». 

This old issue (#499) appears to be similar, but the solution is to use a grunt package that is currently marked as depreciated so ¯\_(ツ)_/¯

I'm using grunt-contrib-uglify version 5.2.1

alexlamsl commented 2 years ago

sounds like you are using top-level await, which is now supported in version 5.2.2 when module: true is specified.

chidubemOkafor commented 2 years ago

sounds like you are using top-level await, which is now supported in version 5.2.2 when module: true is specified.

I think that's the problem