question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Class private methods are not enabled.

See original GitHub issue

I just upgraded tracked-built-ins in an addon and am getting this error:

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

ember-statechart-component/tracked-built-ins/-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) {

but, what’s weird, is that I’ve worked on tracked-built-ins with private methods… and this wasn’t an issue at all.

My ember-cli-babel appears up to date:

❯ npm ls ember-cli-babel
β”œβ”€β”¬ @ember/test-helpers@2.6.0
β”‚ β”œβ”€β”¬ @ember/test-waiters@3.0.0
β”‚ β”‚ └── ember-cli-babel@7.26.6 deduped
β”‚ β”œβ”€β”€ ember-cli-babel@7.26.6 deduped
β”‚ └─┬ ember-destroyable-polyfill@2.0.3
β”‚   └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ @glimmer/component@1.0.4
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ ember-auto-import@1.12.0
β”‚ β”œβ”€β”¬ @embroider/core@0.33.0
β”‚ β”‚ └─┬ @embroider/macros@0.33.0
β”‚ β”‚   └── ember-cli-babel@7.26.6 deduped
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”€ ember-cli-babel@7.26.6
β”œβ”€β”¬ ember-cli-typescript-blueprints@3.0.0
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ ember-could-get-used-to-this@1.0.1
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ ember-load-initializers@2.1.2
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ ember-maybe-import-regenerator@0.1.6
β”‚ └── ember-cli-babel@6.18.0
β”œβ”€β”¬ ember-page-title@6.2.2
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ ember-qunit@5.1.5
β”‚ β”œβ”€β”€ ember-cli-babel@7.26.6 deduped
β”‚ └─┬ ember-cli-test-loader@3.0.0
β”‚   └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ ember-resolver@8.0.3
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ ember-source@3.26.2
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ qunit-dom@1.6.0
β”‚ └── ember-cli-babel@7.26.6 deduped
β”œβ”€β”¬ tracked-built-ins@2.0.0
β”‚ β”œβ”€β”€ ember-cli-babel@7.26.6 deduped
β”‚ └─┬ ember-tracked-storage-polyfill@1.0.0
β”‚   └── ember-cli-babel@7.26.6 deduped
└─┬ tracked-maps-and-sets@3.0.2
  └── ember-cli-babel@7.26.6 deduped


ember-statechart-component on ξ‚  upgrade-debs [$!] 

  origin  git@github.com:NullVoxPopuli/ember-statechart-component.git 

❯ latestPkgVer ember-cli-babel
Current:
"7.26.6"

Tags:
{
  "latest": "7.26.6",
  "alpha": "7.0.0-alpha.2",
  "beta": "7.24.0-beta.2",
  "5.x": "5.2.8",
  "old": "6.17.2"
}

Most Recent:
"7.26.6"

and browserslist seems to be up to date as well.

❯ npx browserslist --update-db
Latest version:     1.0.30001279
Installed version:  1.0.30001279
caniuse-lite is up to date
caniuse-lite has been successfully updated

No target browser changes

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:47 (37 by maintainers)

github_iconTop GitHub Comments

5reactions
chriskrychocommented, Dec 6, 2021

rwjblue and I are going to try to get this knocked out tomorrow; in the meantime, folks may be able to work around it by pinning caniuse-lite to 1.0.30001280. (We did that for an internal addon and it did the trick.)

2reactions
chriskrychocommented, Nov 30, 2021

All right, cool. I’ll chat with @rwjblue and see if we can land the fix in ember-cli-babel now that Data is unblocked, and that should then cascade out to the rest of the ecosystem β€œautomagically” by way of Renovate/Dependabot/etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Enable Private Method Syntax Proposal in React App?
I got "Class private methods are not enabled." error when running npm start on a project using leading # to indicate private methods....
Read more >
babel/plugin-proposal-private-methods
When true, private methods will be assigned directly on its parent via Object.defineProperty rather than a WeakSet . This results in improved performanceΒ ......
Read more >
Babel 7.14 enables class fields & private methods by default ...
Babel 7.14 enables class fields & private methods by default in @babel/preset-env ... Babel is a free and open-source JavaScript transcompiler. ItΒ ...
Read more >
Private class features - JavaScript - MDN Web Docs - Mozilla
Class fields are public by default, but private class members can be ... Unlike public methods, private methods are not accessible onΒ ...
Read more >
@babel/plugin-proposal-private-methods - npm
This plugin transforms private class methods. Latest version: 7.18.6, last published: 6 months ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found