robatwilliams / es-compat

Check JavaScript code compatibility with target runtime environments
MIT License
64 stars 13 forks source link

ES module support for check-es-compat #69

Open robatwilliams opened 1 year ago

robatwilliams commented 1 year ago

Its parserOptions doesn't include sourceType: 'module', and top-level await can only be used in ES modules.

Parsing error: Unexpected token Promise
robatwilliams commented 1 year ago

I didn't check the tool before releasing v3.0.0, despite it being on the checklist in contributing.md

robatwilliams commented 1 year ago

There are probably some things on the other hand, that are not allowed in sourceType=module.

Needs thinking.

Quite niche issue probably. Fix when doing next batch of work.

robatwilliams commented 1 year ago

ES2020 import.meta and export * as have the same problem, nobody complained so far...

robatwilliams commented 1 year ago

Tool needs to be told what the sourceType is, so needs a command line arg.

Even import/export statements don't work.

benasher44 commented 1 year ago

Would love to see this! We'd like to use this package to check our final frontend build, and most frontend builds these days are ESM (including ours)