我正在做一个使用React的项目,我是React的新手,对在symfony中设置webpack配置文件没有特别的经验。我在浏览器中收到此错误:
kill -9 <PID>
// webpack
class App extends React.Component {
> _canvas = null
| _dimension = null
| _margin = 30
我在做什么错了?
答案 0 :(得分:1)
确保已安装es2015 babel预设。
npm install babel-preset-es2015
在webpack.config中配置babel-loader:
{
test: /\.jsx?$/, // Match both .js and .jsx files
exclude: /node_modules/,
loader: "babel-loader",
query: {
presets:['es2015', 'react']
}
},