1
Error: Missing class properties transform
Test.js:無法編譯。錯誤:缺少類屬性變換
export default class Home extends React.Component {
static defaultProps = {
color: 'blue',
text: 'Confirm'
};
}
.babelrc:
{
"presets": ["latest", "react"],
"plugins": ["transform-class-properties"]
}
的package.json:
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-latest": "^6.24.1",
"babel-preset-react": "^6.24.1",
我不知道我是否應該要求其他模塊
它不應該是必要包括整個舞臺-0,除非你使用了大量的0階段特性(無論如何,類屬性都是階段3)。否則,只需使用類屬性轉換babel插件即可。所以我不確定更有針對性的解決方案是什麼(我有同樣的問題)。 – batjko