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.

Can not enable `syntax-class-properties` with other fields related plugins

See original GitHub issue

Bug Report

  • I would like to work on a fix!

Current behavior

Input Code

export class Foo {
  #bar = 'bar'
}

Expected behavior

I’d like to keep class properties as-is.

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
module.exports = {
  plugins: [
    '@babel/syntax-class-properties',
    '@babel/proposal-private-methods',
  ],
}

Environment

- Babel version(s): v7.12.10
- Node/npm version: Node v12.20.0/npm 6.14.9
- OS: macOS 11.2 Beta
- Monorepo: no
- How you are using Babel: API directly

Possible Solution

Check syntax-class-properties instead of proposal-class-properties for class fields

Additional context

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolo-ribaudocommented, Jan 26, 2021

This is probably fixed by part of https://github.com/babel/babel/pull/12250, I can split that PR in two separate PRs.

0reactions
nicolo-ribaudocommented, May 11, 2021

I’m preparing https://github.com/babel/babel/pull/13260 as an alternative for #12250, which gives better and easier control on how the different class features transforms interact.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for the experimental syntax 'classProperties' isn't ...
I just solve this problem by adding @babel/plugin-proposal-class-properties into webpack config plugin. The module section of my ...
Read more >
babel/plugin-transform-typescript
This plugin adds support for the types syntax used by the TypeScript programming language. However, this plugin does not add the ability to...
Read more >
@babel/plugin-proposal-class-properties - Package Manager
This plugin transforms static class properties as well as properties declared with the property initializer syntax. babel-plugin ...
Read more >
support for the experimental syntax 'decorators' isn't currently ...
I'm using mobx in a react app and I keep getting this error: Support for the experimental syntax 'decorators-legacy' isn't currently enabled in...
Read more >
Support for the experimental syntax 'classProperties' isn't ...
In the general case, all the babel configuration can be passed down from babel.config.js or any other supported formate files. But in my...
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