Search code examples
node.jsreactjsecmascript-6ecmascript-5ecmascript-2017

environment setup for ReactJS


currently i am doing environment setup for react.js with npm (babel, webpack and etc.) and i now i am filling webpack.config.js file and tutorial that i am following has next code :

 module: {
  rules: [
     {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: {
           presets: ['es2015', 'react']
        }
     }
  ]
},

and as i see in presents property there are written es2015 (ECMAScript 5) and i want to know it is better be like that or i should switch it to ES6 or ES7 because it is 2019 and even ES6 has way too more features. i just started react and if i asked something stupid, correct me. thanks


Solution

  • you need @babel/preset-env package instead of es2015