We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It's possible to generate code where _async helper is not injected resulting in a ReferenceError.
_async
ReferenceError
function _await(value, then, direct) { if (direct) { return then ? then(value) : value; } if (!value || !value.then) { value = Promise.resolve(value); } return then ? value.then(then) : value; } System.register([], function (_export, _context) { "use strict"; var answer; return { setters: [], execute: _async(function () { return _await(Promise.resolve(), function () { _export("answer", answer = 42); }); }) }; });
☝️ The code above can be generated with the following js:
const { transform } = require("@babel/core") const { code } = transform( `await Promise.resolve() export const answer = 42`, { plugins: [ require("@babel/plugin-transform-modules-systemjs"), [ require("babel-plugin-transform-async-to-promises"), { topLevelAwait: "return", }, ], ], }, ) console.log(code)
The text was updated successfully, but these errors were encountered:
The following patch fix the issue
case "return": { + helperReference(this, path, '_async') rewriteAsyncBlock(
At
babel-plugin-transform-async-to-promises/async-to-promises.ts
Line 4852 in c7c006c
Sorry, something went wrong.
No branches or pull requests
It's possible to generate code where
_async
helper is not injected resulting in aReferenceError
.☝️ The code above can be generated with the following js:
The text was updated successfully, but these errors were encountered: