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

Comments

Projects
None yet
3 participants
@hibikiledo

hibikiledo commented Nov 8, 2018

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

This comment has been minimized.

Collaborator

babel-bot commented Nov 8, 2018

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

This comment has been minimized.

Member

loganfsmyth commented Nov 9, 2018

Thanks, I posted a fix: #9003

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

@hibikiledo

This comment has been minimized.

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 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment