webpack.config.js(lines 14 - 28). What we're doing is telling webpack that we want to look for all the files that end with .js (line 17), excluding node modules (line 18), and we want to use
babel-loaderto process those files (line 21).
babel-loaderwill automatically reference a .babelrc file Add a
.babelrcfile to our project directory.
.babelrctells babel-loader which preset to use, which in our case is
@babel/preset-env. Browserlist a manages list of browsers and what code versions they support.
.browserslistrcfile. The code that Babel produces will be supported by this set of browsers. Learn more about browserslist here.
arrowand what we want from
/src/index.jsfile (our entry point) which in this case is the feature called
function(lines 6 and 7). We are also able to import the entire
core-jsbut it is not practical as it would take up too much space.