Error when using compat package

When I try to register the @aurelia/compat-v1 package, I get the following error:

Uncaught TypeError: Invalid property descriptor. Cannot both specify accessors and a value or writable attribute, #<Object>
    at Function.defineProperty (<anonymous>)
    at entry.bundle.js:4466:16
    at Array.forEach (<anonymous>)
    at defineBindingMethods (entry.bundle.js:4465:7)
    at Object.register (entry.bundle.js:4610:9)
    at Container.register (entry.bundle.js:5510:25)
    at Aurelia.register (entry.bundle.js:23360:24)
    at Aurelia.register (entry.bundle.js:28617:30)
    at ./src/main.ts (entry.bundle.js:1013:49)
    at __webpack_require__ (entry.bundle.js:28666:33)

Repro: compat package - StackBlitz

Am I doing something wrong? Many thanks in advance for any help!

1 Like

It’s a bug in the compat package, somehow was not detected. The issue boils down to this

Object.defineProperty(obj, key, {
  writable: true,
  get() { }
})

If there’ both writable and get on the property descriptor (3rd param), then it💥

A new dev version with the fix for this issue is out, maybe you can try that and see if it fixes your issue?

It is working now, thank you very much!

1 Like