module
object to 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-loader
to process those files (line 21).babel-loader
will automatically reference a .babelrc file Add a .babelrc
file to our project directory. .babelrc
tells babel-loader which preset to use, which in our case is @babel/preset-env.
./src/index.js
@babel/preset-env
. Browserlist a manages list of browsers and what code versions they support..browserslistrc
file. The code that Babel produces will be supported by this set of browsers. Learn more about browserslist here.arrow
and what we want from core-js
into our /src/index.js
file (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-js
but it is not practical as it would take up too much space./dist/main.js
.