Skip to content

Commit 59704e4

Browse files
committed
configure webpack to use babel-loader
Babel configs are now placed in webpack.config.js
1 parent 5010254 commit 59704e4

File tree

2 files changed

+40
-26
lines changed

2 files changed

+40
-26
lines changed

babel.config.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

webpack.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,44 @@ module.exports = {
3535
// https://webpack.js.org/configuration/output/#outputpublicpath
3636
publicPath: "/",
3737
},
38+
39+
// Determine how the different types of modules will be treated.
40+
// https://webpack.js.org/configuration/module
41+
// https://webpack.js.org/concepts#loaders
42+
module: {
43+
rules: [
44+
{
45+
test: /\.js$/, // Apply this rule to files ending in .js
46+
exclude: /node_modules/, // Don't apply to files residing in node_modules
47+
use: {
48+
// Use the following loader and options
49+
loader: "babel-loader",
50+
// We can pass options to both babel-loader and Babel. This option object
51+
// will replace babel.config.js
52+
options: {
53+
presets: [
54+
[
55+
"@babel/preset-env",
56+
{
57+
debug: true, // Output the targets/plugins used when compiling
58+
59+
// Configure how @babel/preset-env handles polyfills from core-js.
60+
// https://babeljs.io/docs/en/babel-preset-env
61+
useBuiltIns: "usage",
62+
63+
// Specify the core-js version. Must match the version in package.json
64+
corejs: 3,
65+
66+
// Specify which environments we support/target for our project.
67+
// (We have chosen to specify targets in .browserslistrc, so there
68+
// is no need to do it here.)
69+
// targets: "",
70+
},
71+
],
72+
],
73+
},
74+
},
75+
},
76+
],
77+
},
3878
};

0 commit comments

Comments
 (0)