![](/img/trans.png)
[英]Module build failed: SyntaxError: Missing class properties transform when using webpack2
[英]How to fix 'Module build failed: SyntaxError: Missing class properties transform.'?
在我的reactjs組件中,我有這樣的代碼:
increment = () => {
store.dispatch({type: 'INC'});
}
當我在控制台中運行npm start時,我得到:
Module build failed: SyntaxError: Missing class properties transform.
我安裝了:
npm install --save-dev babel-plugin-transform-class-properties
並將此添加到我的.babelrc:
"plugins": [
"transform-class-properties"
],
"presets": [
"es2015",
"react",
"stage-0"
],
我該如何解決這個問題?
你有沒有看到這篇文章: 錯誤:缺少類屬性轉換 ?
我遇到了類似的問題,並且,正如上面接受的答案中的一條評論所示,我在.babelrc
文件和webpack.config
中都列出了預設。 我從webpack.config
刪除了冗余選項,現在它運行了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.