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

[1.6-beta.18] Invalid babel output #9013

Closed
janowsiany opened this issue Aug 14, 2017 · 5 comments
Closed

[1.6-beta.18] Invalid babel output #9013

janowsiany opened this issue Aug 14, 2017 · 5 comments
Milestone

Comments

@janowsiany
Copy link
Contributor

janowsiany commented Aug 14, 2017

I am running METEOR@1.6-beta.18, inside my codebase i am doing object destructuring with rest syntax which transpiles into:

var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");

var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const {
  a: {
    b: {
      c
    }
  }
} = settings,
      other = (0, _objectWithoutProperties3.default)(settings.b.a, ["c"]);

If you did not noticed the order of the keys in the path for other is wrong.

Expected result is like.
Repro

cc: @benjamn @abernix @hwillson @radekmie @skirunman

@janowsiany janowsiany mentioned this issue Aug 16, 2017
11 tasks
@benjamn benjamn added this to the Release 1.6 milestone Aug 17, 2017
@janowsiany
Copy link
Contributor Author

janowsiany commented Sep 6, 2017

Still reproducible with meteor@1.6-beta.25. @benjamn any clues? I could investigate this problem more deeply if only knew the direction.

@hexagon6
Copy link

hexagon6 commented Sep 8, 2017

@janowsiany since this is a babel-transform, we should test if this is normal behaviour in babel too.

Meteor uses the following babel-preset for ES-transforms https://github.com/meteor/babel-preset-meteor.

In your case I would think that it is this transform: https://babeljs.io/docs/plugins/transform-object-rest-spread/

@janowsiany you could test it like this: babel --plugins transform-object-rest-spread script.js and then compare.

@janowsiany
Copy link
Contributor Author

@benjamn after upgrade up to meteor@1.6-beta.30 this issue does not occur anymore. I will close this issue but if you have some spare time you could explain what happened.

@abernix
Copy link
Contributor

abernix commented Sep 19, 2017

@janowsiany Meteor 1.6 beta.30 uses Babel 7 (beta.0) and Node 8.5.0. Node 8.5.0 natively supports the syntax that you're trying to use (without Babel). It could have been an actual bug in Babel, but @benjamn has also been removing unnecessary Babel plugins which are no longer necessary with Node 8. It's possible that there was a plugin which was still enabled which was not necessary?

@janowsiany
Copy link
Contributor Author

Right, i know about Babel and Node upgrades but shouldn't Babel transpiled syntax be valid in Node 8.5.0 also(if we assume that a plugin was still enabled)? Also checked if it was Babel bug itself but it wasn't(you can check the repro done with Babel REPL in my very first comment), unless it was a bug in Babel 7th(REPL is running 6.x.x i guess). Anyway, it is cool that it is no longer an issue ⚡. CAn't wait for RC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants