preactjs / wmr

👩‍🚀 The tiny all-in-one development tool for modern web apps.
https://wmr.dev/
MIT License
4.92k stars 109 forks source link

feat: Allow top-level await in dev #924

Closed rschristian closed 2 years ago

rschristian commented 2 years ago

Supports TLA in dev. Users would otherwise be me with the following:

500 \<source> - Cannot use keyword 'await' outside an async function (\<source>)

I should add that TLA works just fine in prod build; parser doesn't throw an error and allows it to pass just fine. This is only an issue in dev.

This of course won't work in all environments, but I think it's probably fair to at least enable the syntax to get past the parser? If a user needs to support an older browser or is running a version of Node that doesn't support it, I think it's fair to leave that up to them to correct.

changeset-bot[bot] commented 2 years ago

🦋 Changeset detected

Latest commit: b8492382ea2d35aa028e36ed0207c7c4742b1bd3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---- | ----- | | wmr | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR