codesandbox / codesandbox/codesandbox-client

can't use top-level await in projects where you set es2020 or something

Open
#8,435 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

🐛 bug report

Preflight Checklist

  • I have read the [Contributing Guidelines][contributing] for this project.
  • I agree to follow the [Code of Conduct][code_of_conduct] that this project
    adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

I can't use await

e.g. if you open the Browser console you can do something pointless like await console.log("HI") and it won't throw an error.
On Codesandbox you can't.

 

Similar to https://github.com/codesandbox/codesandbox-client/issues/8433 except that it's for top-level await.

To Reproduce

https://codesandbox.io/p/sandbox/hungry-forest-forked-3ssrkq?file=%2Fsrc%2Findex.ts

https://codesandbox.io/p/sandbox/codesandbox-github-async-await-issue-7hpwm8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure in the two linked CodeSandbox projects, especially the /src/index.ts example, and compare it with top-level await in a browser console. Trace how an ES2020 project is processed; done means top-level await works without an error in the affected sandbox configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.