complete-javascript-course icon indicating copy to clipboard operation
complete-javascript-course copied to clipboard

Private class issue

Open carmennnnandra opened this issue 3 years ago • 5 comments

I’m trying to declare the private class and when i run the project this is the error @parcel/transformer-js: This experimental syntax requires enabling one of the following parser plugin(s): 'classPrivateProperties, classPrivateMethods' (2:4) an this is my json

{​​​​​   "name": "licenta_carmen",   "version": "1.0.0",   "description": "Recipe application",   "main": "index.html",   "scripts": {​​​​​     "start": "parcel index.html",     "build": "parcel build index.html"   }​​​​​,   "author": "Melniciuc Carmen Andra",   "license": "ISC",   "devDependencies": {​​​​​     "@babel/plugin-proposal-private-methods": "^7.13.0",     "@parcel/transformer-sass": "^2.0.0-beta.2",     "parcel": "^2.0.0-beta.2"   }​​​​​,   "dependencies": {​​​​​     "core-js": "^3.9.1",     "regenerator-runtime": "^0.13.7"   }​​​​​    }

carmennnnandra avatar Mar 29 '21 11:03 carmennnnandra

Happened to me yesterday. I've been searching for 4h. You just need to create a new file inside main folder (where is the package.json) with the name .babelrc and insert this in it: { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-private-methods" ] } Sper ca te ajuta :)

banicaDaniel07 avatar Mar 29 '21 16:03 banicaDaniel07

Happened to me yesterday. I've been searching for 4h. You just need to create a new file inside main folder (where is the package.json) with the name .babelrc and insert this in it: { "plugins": [ "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-private-methods" ] } Sper ca te ajuta :)

Multumesc frumos! A mers. gasisesm pe net cateva chestii care imi indicau acelasi lucru dar nu intelegeam unde trebuiau aceste doua plugin-uri...

carmennnnandra avatar Mar 29 '21 18:03 carmennnnandra

Multumesc frumos! A mers. gasisesm pe net cateva chestii care imi indicau acelasi lucru dar nu intelegeam unde trebuiau aceste doua plugin-uri...

Cu placere. Si mie mi-au iesit peri albi pana mi-am dat seama.

banicaDaniel07 avatar Mar 30 '21 09:03 banicaDaniel07

Hei,

I have the same issue, and I do not know how to solve it, Hope you guys can help me

My package.json looks like this:

{
  "name": "forkify",
  "version": "1.0.0",
  "description": "Recipe app",
  "main": "index.html",
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html"
  },
  "author": "Enio Marku",
  "license": "ISC",
  "devDependencies": {
    "@babel/plugin-proposal-class-properties": "^7.13.0",
    "@babel/plugin-proposal-private-methods": "^7.13.0",
    "@parcel/transformer-sass": "^2.0.0-beta.2",
    "parcel": "^2.0.0-beta.2"
  }
}

My configure.babelrc looks like this:

{
  "plugins": [
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-private-methods"
  ]
}

This file is in the same root directory as it is package.json. Do I need to include this file into the index.html?

eniomarku avatar Mar 31 '21 22:03 eniomarku

add this to your file { "plugins": ["@babel/plugin-syntax-class-properties"] } your file is in the right place

tiktakisrael avatar Apr 01 '21 09:04 tiktakisrael