babel icon indicating copy to clipboard operation
babel copied to clipboard

Bug when a property has a getter/setter

Open znewsham opened this issue 5 years ago • 1 comments

I'm trying to upgrade from Meteor 1.6 to Meteor 1.11.1 and I'm getting the same error on virtually every file: Invalid property descriptor. Cannot both specify accessors and a value or writable attribute.

Attaching a debugger to the running meteor process (the builder, not the runner) and modifying Object.defineProperty to look for these situations and pause:

origDefineProperty = Object.defineProperty;Object.defineProperty = function(o, p, v, ...args) {
if (v) {
    if ((v.writeable || v.value !== undefined) && (v.get || v.set)) {
        debugger;
    }
}
try {
return origDefineProperty.call(Object, o, p, v, ...args)
}
catch (e) {
  debugger;
  console.error(e); 
  console.log(o, p, v, ...args);
}
}

Shows that the offending value + getter combo is caused by the handleKey function in util.js(https://github.com/meteor/babel/blob/master/util.js#L49)

This is caused by an internal package (a hack to make sourcemaps work better) - but it feels like something that should be fixed, if a getter/setter is defined, don't set the value.

znewsham avatar Nov 19 '20 18:11 znewsham

Hi @znewsham are you willing to work in a PR to fix this?

filipenevola avatar Dec 09 '20 14:12 filipenevola