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

export default async function foo() {} does not declare foo #8697

Closed
mroch opened this issue Sep 12, 2018 · 4 comments
Closed

export default async function foo() {} does not declare foo #8697

mroch opened this issue Sep 12, 2018 · 4 comments
Labels
Needs Info outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@mroch
Copy link
Contributor

mroch commented Sep 12, 2018

Bug Report

Current Behavior

export default async function foo() { return "foo" }
foo().then(console.log)

in node 10.10 with --experimental-modules, this logs "foo". in babel 7.0.0, it says foo is not defined.

Expected behavior/code
I think foo should be in scope.

it's in scope if you remove async. the spec has the same rules for all ExportDeclaration: export default HoistableDeclaration productions, which also leads me to believe that if it's in scope for non-async functions, it should work the same for async functions as well.

Babel Configuration (.babelrc, package.json, cli command)

  ["@babel/plugin-transform-regenerator", {
      "asyncGenerators": false,
      "generators": false,
      "async": false
  }]

Environment

  • Babel version(s): v7.0.0
  • Node/npm version: 10.10
  • OS: macOS 10.13.6
  • How you are using Babel: cli
@babel-bot
Copy link
Collaborator

Hey @mroch! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Sep 12, 2018

What is the code generated by Babel? You are disabling the async functions transform ("async": false), so Babel desn't transpile that function.

@babel-bot
Copy link
Collaborator

Hi @mroch! A maintainer of the project has notified me that you're missing
some information we'll need to replicate this issue.

Please understand that we receive a high volume of issues, and there are only a limited number
of volunteers that help maintain this project. The easier it is for us to decipher an issue with the info provided,
the more likely it is that we'll be able to help.

Please make sure you have the following information documented in this ticket:

  1. Your Babel configuration (typically in the form of a .babelrc)
  2. The current (incorrect) behavior you're seeing
  3. The behavior you expect
  4. A short, self-contained example

Please provide either a link to the problem via the repl, or if the repl is insufficient,
a new and minimal repository with instructions on how to build/replicate the issue.

@danez
Copy link
Member

danez commented Nov 19, 2018

I just tested this and I'm not able to reproduce this. If it is still a problem please reopen and provide an example that triggers the error.

@danez danez closed this as completed Nov 19, 2018
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Feb 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs Info outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

4 participants