We can close that. Then in our webpack config, we have the ability to configure loaders to pass our source code through before it ultimately gets bundled for distribution. In the webpack config, I'm going to add a new key called module. Module's going to take an object. In that object, we're going to have a rules key.
Rules is going to be an array. Each item in this array can be an object. The first key we're going to pass to rules is going to be test. This is going to decide which modules this rule applies to. I'll pass a regular expression.
Then, we can pass options into the loader itself. We'll have an options key, and this will be an object. We're going to give this presets. Presets will be an array. The only preset we have now is the babel/preset-env.
With our loader configured, let's save that. Then in the terminal, I'm going to do npm run build. If we look at our app bundle and if we jump to the end, we'll see that instead of string interpolation, we have a string using the concat method. Instead of an arrow function like we do in our source, we have a function expression being assigned to a variable, not a constant.
Webpack has used the babel-loader to transform our code before creating our output bundle.