Skip to content
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

generators:false not honored - still outputs code using generators #67

Closed
rjgotten opened this issue Jul 17, 2019 · 2 comments
Closed

Comments

@rjgotten
Copy link

Even when specifying generators:false a source function

(async () => {
  await Promise.all([a, b]);
  console.log("ready");
});

generates

(function* () {
  yield Promise.all([a, b]);
  console.log("ready");
})();

which continues to use generators.

Using fast-async 7.0.6

@verydanny
Copy link

This is because you have to disable the generator options in @babel/preset-env. Like so:

module.exports = {
  presets: [
    ['@babel/env', {
      modules: false,
      targets: {
        browsers: ['last 2 Chrome versions'],
      },
      exclude: [
        'transform-async-to-generator',
        'transform-regenerator',
      ],
    }],
  ],
  plugins: [
    ['module:fast-async', {
      spec: true,
    }],
  ],
}

@rjgotten
Copy link
Author

rjgotten commented Jul 17, 2019

Yup. I just noticed this myself as well.
The config I was working off of, was only disabling regenerator, and not the actual async-to-generator transformation. Doh! (Of all the stupid oversights...)

Closing this, as it's invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants