Skip to content

Commit

Permalink
configure webpack to use babel-loader
Browse files Browse the repository at this point in the history
Babel configs are now placed in webpack.config.js
  • Loading branch information
nicoqh committed Mar 19, 2022
1 parent 5010254 commit 59704e4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
26 changes: 0 additions & 26 deletions babel.config.js

This file was deleted.

40 changes: 40 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,44 @@ module.exports = {
// https://webpack.js.org/configuration/output/#outputpublicpath
publicPath: "/",
},

// Determine how the different types of modules will be treated.
// https://webpack.js.org/configuration/module
// https://webpack.js.org/concepts#loaders
module: {
rules: [
{
test: /\.js$/, // Apply this rule to files ending in .js
exclude: /node_modules/, // Don't apply to files residing in node_modules
use: {
// Use the following loader and options
loader: "babel-loader",
// We can pass options to both babel-loader and Babel. This option object
// will replace babel.config.js
options: {
presets: [
[
"@babel/preset-env",
{
debug: true, // Output the targets/plugins used when compiling

// Configure how @babel/preset-env handles polyfills from core-js.
// https://babeljs.io/docs/en/babel-preset-env
useBuiltIns: "usage",

// Specify the core-js version. Must match the version in package.json
corejs: 3,

// Specify which environments we support/target for our project.
// (We have chosen to specify targets in .browserslistrc, so there
// is no need to do it here.)
// targets: "",
},
],
],
},
},
},
],
},
};

0 comments on commit 59704e4

Please sign in to comment.