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 7.1.5 won't compile with retainLines: true and plugin-proposal-object-rest-spread #8992

Closed
hibikiledo opened this issue Nov 8, 2018 · 3 comments · Fixed by #9003
Closed
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@hibikiledo
Copy link

Bug Report

Current Behavior

TypeError: Cannot read property 'start' of undefined
    at Generator.ArrowFunctionExpression (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/generators/methods.js:136:72)
    at withSource (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/printer.js:299:22)
    at Buffer.withSource (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/buffer.js:185:28)
    at Generator.withSource (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/printer.js:178:15)
    at Generator.print (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/printer.js:298:10)
    at Generator.printJoin (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/printer.js:362:12)
    at Generator.printList (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/printer.js:422:17)
    at Generator.CallExpression (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/generators/expressions.js:181:8)
    at withSource (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/printer.js:299:22)
    at Buffer.withSource (/Users/hibikiledo/Desktop/babel-generator-7.1.5-bug/node_modules/@babel/generator/lib/buffer.js:185:28)

Input Code
Please see https://github.com/hibikiledo/babel-generator-7.1.5-bug

Expected behavior/code
Babel should compile input code without throwing an error.

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

{
  "env": {
    "development": {
      "retainLines": true,
      "plugins": [
        "@babel/plugin-proposal-object-rest-spread"
      ]
    }
  }
}

Environment

  • Babel version(s): 7.1.5
  • Node/npm version: Node 8.12.0
  • OS: OSX 10.13.6
  • Monorepo: no
  • How you are using Babel: cli

Possible Solution
Remove retainLines seems to fix the problem.

Additional context/Screenshots
none

@babel-bot
Copy link
Collaborator

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

@loganfsmyth
Copy link
Member

Thanks, I posted a fix: #9003

Do you mind if I ask why you're using retainLines? We've often considered removing it.

@hibikiledo
Copy link
Author

hibikiledo commented Nov 9, 2018

I don't know why it is there in the first place. I checked the commit message and still had no clue.

I ended up removing it permanently since I already had source maps enabled.

Thanks for the fix anyway 🥇

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

Successfully merging a pull request may close this issue.

3 participants