tracked-tools / tracked-built-ins

Tracked versions of JavaScript's built-in classes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v2 error: class private methods are not enabled

nightire opened this issue · comments

I saw this error after upgrading tracked-built-ins to v2.0.0:

Build Error (broccoli-persistent-filter:Babel > [Babel: tracked-built-ins]) in -private/object.js

/Users/nightire/Code/github.com/choice-form/mono-apps/packages/os-portal/-private/object.js: Class private methods are not enabled.
  65 |
  66 |   // @private
> 67 |   #readStorageFor(key) {
     |   ^
  68 |     let storage = this.#storages.get(key);
  69 |
  70 |     if (storage === undefined) {

It happens with both the latest version of classic ember-cli and embroider, I've already tried with @babel/plugin-proposal-private-methods plugin, but the same error remains.

This appears to be a bug with ember-cli-babel, where it does not correctly use the plugins / preset / targets / browserlist available to the host app. 🤔

Nope, it's a misconfiguration in this addon; addons should handle this themselves because they cannot guarantee what the host will or won't be providing. I will publish a bug fix tomorrow. (Embroider will handle this differently: we will publish spec ES and let folks down stream further process based on their targets but for now this is the right place to fix.)

Possibly I’m wrong and there is an ember-cli-babel bug, as this appears to be resolving the correct version of @babel/preset-env etc. 🤔

I’ve upgraded to this in the big app at work and it works just fine. (I'll report this on the ember-cli-babel repo as well.)

We've confirmed this is an upstream issue, and will continue tracking in emberjs/ember-cli-babel#419. Closing accordingly.

commented

I'm seeing this in Ember 4.3.0 using the pdfjs-dist module which uses private methods