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

Use of undefined-returning-function result in ES2015 CommonJS module transform (T7565) #4462

Closed
babel-bot opened this issue Aug 22, 2016 · 0 comments
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@babel-bot
Copy link
Collaborator

Issue originally made by Justin Johansson (justinjohansson)

Bug information

  • Babel version: 6.11.4 (babel-core 6.13.2)
  • Node version: v6.4.0
  • npm version: v6.4.0

Input code

Bug shows up when transpiling following input code with ES2015 CommonJS module transform plugin.

/* file: bar.js */

export { yy, zz };

var yy = 0;
var zz = yy++;

Description

Bug is apparent by visual inspection of code in babel-plugin-transform-es2015-modules-commonjs/src/index.js line 122 in UpdateExpression:

let newPaths = path.replaceWithMultiple(t.sequenceExpression(nodes));
for (const newPath of newPaths) this.requeueInParent(newPath);

replaceWithMultiple is a method which always returns undefined. The following for/in statement will therefore always throw an exception as follows:

babel -d dist src
TypeError: src/bar.js: Cannot read property 'Symbol(Symbol.iterator)' of undefined
    at Object.UpdateExpression
@hzoo hzoo added the i: bug label Sep 14, 2016
loganfsmyth added a commit that referenced this issue Sep 25, 2016
Fix UpdateExpression handling in es2015-modules-commonjs, resolve #4462
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 6, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

2 participants