-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Top level async #345
Comments
Thanks for the feature request. We'll need to do some investigation to see if there are any side effects, but agree this would be a nice feature. |
While not exactly the same as the originally requested feature, Quokka live comments (unlike
|
The feature is implemented in the latest extension version. |
@ArtemGovorov While the simple top-level await is working, this is not: async function* asyncGen() {
yield Promise.resolve(1);
}
for await (const ret of asyncGen()) {
console.log(ret);
}
Wrapping in an async funciton works tough: async function f() {
for await (const ret of asyncGen()) {
console.log(ret);
}
}
f() What can we do? |
@timarandras - thanks for reporting your problem. We've updated our instrumentation code to handle this case. Please update to the latest version of Quokka for your editor to get this fix. |
Works! Thank you. |
This top-level await feature seems to work only in js files, and not in typescript files, where I still get the old |
Unfortunately we can't support top-level await for TypeScript until it is supported by the TypeScript compiler. You may subscribe to the TypeScript issue if you are interested in updates. |
@SwiftWinds In order to make it work in Typescript, you need to configure your Quokka to use native ESM, so that your Quokka file runs as a module (as the error message suggests). |
Issue description or question
I'd love to see quokka handle async/await at top level. For quick prototyping this would be awesome!
Sample code
Quokka.js Console Output
The text was updated successfully, but these errors were encountered: