🐛 Can't add more presets to .babelrc (Merge defaults with babelrc file problem)
See original GitHub issueFrom 1.5.1 to 1.62 I cannot get rid of “Missing class properties transform” when using stage-2 preset. It seems that under some situations the babelrc gets ignored (or that “env”, “react” presets are locked)
🎛 Configuration (.babelrc, package.json, cli command)
I am using --no-cache all the time so deleting the cache is not an applicable workaround for my case.
babel
{
"presets": ["env", "react", "stage-2"]
}
package
{
"name": "ui",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "parcel src/index.html --no-cache",
"build": "parcel build src/index.html --no-cache"
},
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.7",
"react-router-dom": "^4.2.2"
},
"devDependencies": {
"babel-preset-env": "^1.6.1",///with or without it
"babel-preset-react": "^6.24.1",///with or without it
"babel-preset-stage-2": "^6.24.1",
"parcel-bundler": "^1.6.2"
}
}
🤔 Expected Behavior
Babel should respect my babel config and include all the transformations that this preset should add.
😯 Current Behavior
Babel seems to ignore my config and still errors with “Missing class properties”
💁 Possible Solution
I tried to read the codebase, but i don’t know it too well. However I suspect it related to a pkg constructor param which seems to block the reading of the babel file under some circusntamces.
🔦 Context
I just want to use transform class properties syntax
💻 Code Sample
import React from 'react'
class Root extends React.Component {
state = { time: 0 }//errors here
render() {
return 'hi from react ' + this.state
}
}
export default Root
🌍 Your Environment
| Software | Version(s) |
|---|---|
| Parcel | from 1.5.1 to 1.6.2 |
| Node | 8.9.2 |
| npm/Yarn | 1.2.1 |
| Operating System | windows 10 (and ubuntu 16.04 only parcel 1.6.2) |
I think this is related to https://github.com/parcel-bundler/parcel/issues/824 and https://github.com/parcel-bundler/parcel/issues/824
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:25 (8 by maintainers)

Top Related StackOverflow Question
I’ve run into the same problem with
.babelrc:and compiled success after adding
"plugins": ["transform-class-properties"].babelrc:Parcel 2 will no longer merge
.babelrcwith a default config for babel-preset-env. Instead,.babelrcwill override the default config.