Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing class static properties #10620

Open
ShinobiWPS opened this issue Oct 31, 2019 · 6 comments
Labels

Comments

@ShinobiWPS
Copy link

@ShinobiWPS ShinobiWPS commented Oct 31, 2019

Bug Report

Current Behavior
When I use a Class with static property (like a simple variable) it breaks and suggest to add a plugin or class,if I remove static properties everything work perfectly as expected.

Input Code

import Tabulator from 'tabulator-tables'
/* import '../vendor/cleanslate.css' */
import { config } from './config'

class SiapTable {
  static el;

  static defaultConfig = config

  static create (parentElement, data) {
    function doRender () {
      if (SiapTable.el) {
        throw new Error('SiapTable is already mounted, unmount first')
      }

      /* const el = document.createElement('div')
      el.setAttribute('class', 'cleanslate') */

      if (parentElement) {
        document.querySelector(parentElement).appendChild(el)
      } else {
        console.error('')
      }

      const table = new Tabulator(el, { ...data, ...SiapTable.defaultConfig })
      SiapTable.el = el
    }

    if (document.readyState === 'complete') {
      doRender()
    } else {
      window.addEventListener('load', () => {
        doRender()
      })
    }
  }
}
export default SiapTable
/* export { default as Siap } */
/* export {table} */

Expected behavior/code
Since every modern browser now supports es6 ,classes too, I expected to have "@babel/plugin-proposal-class-properties" included in preset-env

Babel Configuration (.babelrc, package.json, cli command)

{
  "presets": ["@babel/preset-env"]
}

Environment

  • Babel version(s): [7.6.4]
  • Node/npm version: [npm 6]
  • OS: [OSX 10.13.4]
  • Monorepo: [no]
  • How you are using Babel: [loader]

Possible Solution
Include "@babel/plugin-proposal-class-properties" in dependencies of babel for the ENV preset

Additional context/Screenshots
Screenshot 2019-10-31 at 4 27 31 PM

@babel-bot

This comment has been minimized.

Copy link
Collaborator

@babel-bot babel-bot commented Oct 31, 2019

Hey @ShinobiWPS! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@JLHwung

This comment has been minimized.

Copy link
Contributor

@JLHwung JLHwung commented Oct 31, 2019

You can toggle on the shippedProposals if your targeted browsers have native support.

By default preset-env supports latest finalized ECMAScript standard. Note that Class field proposal is still stage 3, though it is supported on major browsers.

@ShinobiWPS

This comment has been minimized.

Copy link
Author

@ShinobiWPS ShinobiWPS commented Oct 31, 2019

You can toggle on the shippedProposals if your targeted browsers have native support.

By default preset-env supports latest finalized ECMAScript standard. Note that Class field proposal is still stage 3, though it is supported on major browsers.

tryed and same exact output as in the screenshot above
{ "presets": [["@babel/preset-env", { "shippedProposals": true }]] }

@JLHwung

This comment has been minimized.

Copy link
Contributor

@JLHwung JLHwung commented Oct 31, 2019

@ShinobiWPS Sorry, my bad. shippedProposals tracks Stage 4 proposals only. For stage 3 proposal, you still have to add it to the plugins section.

@ShinobiWPS

This comment has been minimized.

Copy link
Author

@ShinobiWPS ShinobiWPS commented Oct 31, 2019

where i can track the progress of stage for that particular proposal?

@JLHwung

This comment has been minimized.

Copy link
Contributor

@JLHwung JLHwung commented Oct 31, 2019

You can check the status of active proposals on https://github.com/tc39/proposals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.