Error: Missing class properties transform
Errore: proprietà classe mancante trasformano
Test.js
:
export class Test extends Component {
constructor (props) {
super(props)
}
static contextTypes = {
router: React.PropTypes.object.isRequired
}
.babelrc
:
{
"presets": ["es2015", "react", "stage-0"],
"plugins": ["transform-class-properties"]
}
package.json
:
"babel-core": "^6.5.1",
"babel-eslint": "^4.1.8",
"babel-loader": "^6.2.2",
"babel-plugin-react-transform": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.5.2",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.5.2",
Ho perlustrato il web e tutte le correzioni ruotano intorno: Aggiornamento a babel6, cambiando l'ordine di "stage-0" dopo "es2015". Tutto ciò che ho fatto.
Non c'è bisogno di entrambi. Se hai un '.babelrc' puoi buttare tutti i parametri sul tuo loader. – loganfsmyth
Hai semplicemente risolto il problema modificando il tuo webpack.config.js? Sto affrontando lo stesso problema ma sto usando browserify e non riesco a liberarmene. –
sto usando browserify e sto usando questo oder "es2015", "react", "stage-0". Ho messo la configurazione in .babelrc. – lipp