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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

stage-0 Babel plugin not applying class properties transform #824

Open
oliverjam opened this Issue Feb 16, 2018 · 7 comments

Comments

Projects
None yet
8 participants
@oliverjam

oliverjam commented Feb 16, 2018

馃悰 Bug Report

My class properties have stopped working after updating a small React app to Parcel 1.6.1. I was using babel-preset-stage-0, which worked fine before updating Parcel. Switching to use babel-plugin-transform-class-properties fixes the problem, but the stage-0 preset should include this.

(I also tried the stage-2 preset, but that doesn't work either. Only specifically installing the transform plugin gets the app to build)

馃帥 Configuration

.babelrc

{
  "presets": ["stage-0"]
}

package.json

{
  "name": "parcel-babel-error",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "parcel index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-preset-stage-0": "^6.24.1",
    "parcel-bundler": "^1.6.1"
  },
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0"
  }
}

CLI command

npm start

馃 Expected Behavior

Class properties should be transpiled by babel-preset-stage-0 and the app should build

馃槸 Current Behavior

A build error:

馃毃  /Users/oliverjam/Web/parcel-babel-error/index.js:5:4: /Users/oliverjam/  3 | rcel-babel-error/index.js: Missing class properties transform.
  4 | class App extends React.Component {
> 5 |     state = {}
    |     ^
  6 |     render() {
  7 |         return <h1>Hello</h1>
  8 |     }

馃敠 Context

I'm trying to use class properties via the stage-0 Babel preset, which should encompass all features in the stages above (class properties are in the stage-2 preset).

馃捇 Code Sample

Should be fully reproducible here: https://github.com/oliverjam/parcel-babel-error-repro

馃實 Your Environment

Software Version(s)
Parcel 1.6.1
Node 8.9.4
npm/Yarn npm 5.6.0
Operating System macOS 10.13.3
@Baifamonv

This comment has been minimized.

Show comment
Hide comment
@Baifamonv

Baifamonv Feb 16, 2018

got the same issue. I have installed babel-preset-stage-1

Baifamonv commented Feb 16, 2018

got the same issue. I have installed babel-preset-stage-1

@dackers86

This comment has been minimized.

Show comment
Hide comment
@dackers86

dackers86 Feb 16, 2018

I've had to install manually, new .babelrc is now...

{
"presets": ["preact-app"],
"plugins": ["transform-class-properties"]
}

dackers86 commented Feb 16, 2018

I've had to install manually, new .babelrc is now...

{
"presets": ["preact-app"],
"plugins": ["transform-class-properties"]
}

carloscasalar added a commit to carloscasalar/night-watch-planner that referenced this issue Apr 2, 2018

Refactor to manage state with redux
Also raise node version to 8.4 and solve this issues:
*  [An issue with postcss](parcel-bundler/parcel#876). Solved adding `.postcssrc` file. 
* [Babel plugin not applying class properties transform](parcel-bundler/parcel#824 (comment)). Solved adding babel presets 1 in dev dependencies and `.babelrc` file.
@Offirmo

This comment has been minimized.

Show comment
Hide comment
@Offirmo

Offirmo Jun 15, 2018

Same problem, stage-0

[edit] (ping @CesarLanderos) My problem was happening in a sub module (monorepo linked through node_modules)
The solution was to add a .babelrc in the submodule root.

Offirmo commented Jun 15, 2018

Same problem, stage-0

[edit] (ping @CesarLanderos) My problem was happening in a sub module (monorepo linked through node_modules)
The solution was to add a .babelrc in the submodule root.

@CesarLanderos

This comment has been minimized.

Show comment
Hide comment
@CesarLanderos

CesarLanderos Jul 13, 2018

still happening in 1.9.6

CesarLanderos commented Jul 13, 2018

still happening in 1.9.6

@CesarLanderos

This comment has been minimized.

Show comment
Hide comment
@CesarLanderos

CesarLanderos Jul 20, 2018

to give a little bit of context, i am working on a tool, the tests on that tool repo are working fine (not compiling files/modules with classes tho)

so when i try to integrate that tool into a webapp repo (which dows have classes on its codebase, because of react), i get that error.

i gets fixed by adding the class properties plugin to babel, but that is already specified in stage-0 AFAIK, so its weird that i have to set that in the .babelrc file.

PD: the webapp build process uses another build tool (webpack, it just happens to be already configure with that, not complaining or anything) that grabs the same .babelrc as parcel (without adding the class properties plugin) and it works just fine.

CesarLanderos commented Jul 20, 2018

to give a little bit of context, i am working on a tool, the tests on that tool repo are working fine (not compiling files/modules with classes tho)

so when i try to integrate that tool into a webapp repo (which dows have classes on its codebase, because of react), i get that error.

i gets fixed by adding the class properties plugin to babel, but that is already specified in stage-0 AFAIK, so its weird that i have to set that in the .babelrc file.

PD: the webapp build process uses another build tool (webpack, it just happens to be already configure with that, not complaining or anything) that grabs the same .babelrc as parcel (without adding the class properties plugin) and it works just fine.

@lcx-seima

This comment has been minimized.

Show comment
Hide comment
@lcx-seima

lcx-seima Aug 4, 2018

update: still happening in 1.9.7 馃槄

lcx-seima commented Aug 4, 2018

update: still happening in 1.9.7 馃槄

@qm3ster

This comment has been minimized.

Show comment
Hide comment
@qm3ster

qm3ster Aug 25, 2018

Also, I get Unknown plugin "transform-class-properties" specified in "base" at 0 if installing with pnpm

qm3ster commented Aug 25, 2018

Also, I get Unknown plugin "transform-class-properties" specified in "base" at 0 if installing with pnpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment