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

[babel-runtime] await is a reserved word failure on asyncGenerator.js #5873

Closed
rosskevin opened this issue Jun 20, 2017 · 15 comments
Closed
Labels
6.x: backport i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@rosskevin
Copy link

rosskevin commented Jun 20, 2017

Bug

Webpack compilation now fails. It appears that asyncGenerator.js names a function await and that is now a failure with the most recent babel release. This appears to be generated from a babel-helpers template.

/node_modules/babel-runtime/helpers/asyncGenerator.js
Module build failed: SyntaxError: await is a reserved word (122:20)

  120 |       };
  121 |     },
> 122 |     await: function await(value) {
      |                     ^
  123 |       return new AwaitValue(value);
  124 |     }
  125 |   };
yarn list babel-runtime babel-helpers                                                                                                                                                                                    yarn list v0.24.6
├─ babel-helpers@6.24.1
├─ babel-runtime@6.23.0
└─ es-collections@0.0.2
   └─ babel-runtime@5.8.38

Input Code

Not applicable, failing on babel-runtime itself.

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

{
  "presets": [
    [
      "env",
      {
        "targets": {
          "browsers": "> 5%"
        },
        "modules": false,
        "debug": true
      }
    ],
    "stage-2",
    "react"
  ],
  "plugins": [
    "react-hot-loader/babel",
    ["relay", {"compat": true, "schema": "./schema.json"}],
    "transform-flow-strip-types",
    ["lodash", { "id": ["lodash", "recompose"] }]
  ],
  "env": {
    "development": {
      "sourceMaps": "inline"
    }
  }
}

Expected Behavior

Doesn't fail on babel-runtime

Current Behavior

Webpack compile fails as indicated above

Your Environment

software version(s)
Babel-core 6.25.0
node 8.1.2
yarn 0.24.6
Operating System OSX
@babel-bot
Copy link
Collaborator

Hey @rosskevin! 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.

@rosskevin
Copy link
Author

From slack:

hzoo
[1:17 PM]
#4952? I thought that was what #4954 was doing by @kovensky (edited)

[1:19]
I guess we didn't release a new version of babel-runtime on 6.x https://unpkg.com/babel-runtime@7.0.0-alpha.12/helpers/asyncGenerator.js

@athanasiosem
Copy link

athanasiosem commented Jun 26, 2017

I have the same bug.

When I try to npm run build i get
SyntaxError: node_modules/babel-runtime/helpers/asyncGenerator.js: await is a reserved word (122:20).

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

{ "name": "tempproj", "version": "1.0.0", "description": "", "main": "app.js", "dependencies": { "babel-preset-env": "^1.5.2", "babel-cli": "^6.24.1" }, "devDependencies": {}, "scripts": { "build": "babel src -d lib" }, "author": "", "license": "ISC" }

Expected Behavior

To transpile directory without errors.

Current Behavior

SyntaxError: node_modules/babel-runtime/helpers/asyncGenerator.js: await is a reserved word (122:20).

Your environment

  • babel-core 6.22.1
  • node 7.6.0
  • npm 4.1.2
  • OS Windows 10

@rosskevin
Copy link
Author

I'm seeing the same thing on relay master, @hzoo can we get a maintenance release of babel-runtime to solve this?

@EirikBirkeland
Copy link

I got this exact error today when running babel index.js ./.
However, when I simply run babel index.js without the ./, the error does not occur.

@rosskevin Out of sheer curiosity, can you share the contents of your npm run build?

@rosskevin
Copy link
Author

Now I get this with babili-webpack-plugin.

It is an error that babel-runtime was not released in sync with the other 0.6.25 babel packages. This is really causing a headache for myself and others. Any attention to this matter is greatly appreciated.

@jridgewell
Copy link
Member

We just need to add a function id to the template.

await: function awaiter(value) {
}

@jridgewell
Copy link
Member

Confirmed this a problem with the latest babel-runtime@6.23.0. I'm not sure how, but our function namer didn't realize await is a reserved name (it should name it _await).

@hzoo
Copy link
Member

hzoo commented Jul 26, 2017

Ok I'l just release this manually, sorry

@hzoo
Copy link
Member

hzoo commented Jul 26, 2017

Hope this doesn't break it even more.. https://unpkg.com/babel-runtime@6.25.0/

https://unpkg.com/babel-runtime@6.25.0/helpers/asyncGenerator.js

    await: function _await(value) {

@hzoo
Copy link
Member

hzoo commented Jul 26, 2017

Should be fixed, let me know

@tkshnwesper
Copy link

Happens when async/await is used incorrectly.

@EirikBirkeland
Copy link

EirikBirkeland commented Oct 10, 2017 via email

@purefan
Copy link

purefan commented Feb 18, 2018

@EirikBirkeland how far away is your office? 😮

@EirikBirkeland
Copy link

EirikBirkeland commented Feb 22, 2018

@purefan Betelgeuse

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 24, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
6.x: backport i: bug 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

8 participants