From the course: Learning webpack 4

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Using @babel/preset-env

Using @babel/preset-env

- [Instructor] To actually transform the code, we need to use a preset. In the most recent versions of Babel, we use babel/preset-env, which compiles our code to compatibility with most browsers. To learn more about the methodology behind this, you can check out the documentation at this link here under babel/preset-env. Next let's install this package using npm. We'll say, npm install @babel/preset-env. And then let's save this to our dev dependencies. At this point, we can go back to our webpack.config file and we're going to add on to our loader. So we'll say options. And then we're going to add this presets array. The array at this point will have just @babel/preset-env. So at this point, we can run npm run build. This is going to run this with the watch, and it's going to compile everything to the standards of preset-env, which basically means most every browser is going to be supported here. If you want to…

Contents