Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 9701e75

Browse files
committed
build: update the webpack and babel files with upgraded package configs.
1 parent 1b3bca1 commit 9701e75

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

.babelrc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"presets": [
3-
[ "env", {
3+
[ "@babel/preset-env", {
44
"modules": false,
55
"targets": {
66
"browsers": [
@@ -19,17 +19,17 @@
1919
} ]
2020
],
2121
"plugins": [
22-
"transform-object-rest-spread",
23-
[ "transform-react-jsx", {
22+
"@babel/plugin-transform-object-rest-spread",
23+
[ "@babel/plugin-transform-react-jsx", {
2424
"pragma": "wp.element.createElement"
2525
} ]
2626
],
2727
"env": {
2828
"default": {
2929
"plugins": [
3030
"lodash",
31-
"transform-runtime"
31+
"@babel/plugin-transform-runtime"
3232
]
33-
},
33+
}
3434
}
35-
}
35+
}

webpack.config.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
const webpack = require( 'webpack' );
1010
const glob = require( 'glob' );
11-
const UglifyJsPlugin = require( 'uglifyjs-webpack-plugin' );
11+
const TerserPlugin = require( 'terser-webpack-plugin' );
1212

1313
const externals = {
1414
react: 'React',
@@ -60,22 +60,25 @@ module.exports = [
6060
}
6161
];
6262

63-
if ( process.env.NODE_ENV === 'production' ) {
64-
for ( var moduleConfig of module.exports ) {
65-
moduleConfig.plugins = (
66-
moduleConfig.plugins || []
67-
).concat(
68-
[
69-
new UglifyJsPlugin( {
70-
sourceMap: true,
71-
uglifyOptions: {
63+
if (process.env.NODE_ENV === 'production') {
64+
for (var moduleConfig of module.exports) {
65+
moduleConfig.optimization = {
66+
minimize: true,
67+
minimizer: [
68+
new TerserPlugin({
69+
extractComments: false,
70+
terserOptions: {
7271
ecma: 8,
7372
compress: {
7473
warnings: false
75-
}
74+
},
75+
output: {
76+
comments: false
77+
},
78+
sourceMap: true
7679
}
77-
} )
80+
})
7881
]
79-
);
82+
};
8083
}
81-
}
84+
}

0 commit comments

Comments
 (0)