Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 2 additions & 232 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Breaking Changes

- Remove deprecated `clean-webpack-plugin` dependency in favor of webpack's native cleaning functionality ([#71080](https://github.com/WordPress/gutenberg/pull/71080))

## 30.20.0 (2025-07-23)

## 30.19.0 (2025-06-25)
Expand Down
19 changes: 8 additions & 11 deletions packages/scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
const { BundleAnalyzerPlugin } = require( 'webpack-bundle-analyzer' );
const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' );
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
const webpack = require( 'webpack' );
const browserslist = require( 'browserslist' );
Expand Down Expand Up @@ -108,6 +107,14 @@ const baseConfig = {
filename: '[name].js',
chunkFilename: '[name].js?ver=[chunkhash]',
path: resolve( process.cwd(), 'build' ),
// Clean output directory before emit, except when modules flag is enabled
// to prevent the 2 compilations from cleaning each other's output
...( ! hasExperimentalModulesFlag && {
clean: {
// Keep fonts and images directories
keep: /^(fonts|images)\//,
},
} ),
},
resolve: {
alias: {
Expand Down Expand Up @@ -314,16 +321,6 @@ const scriptConfig = {
SCRIPT_DEBUG: JSON.stringify( ! isProduction ),
} ),

// If we run a modules build, the 2 compilations can "clean" each other's output
// Prevent the cleaning from happening
! hasExperimentalModulesFlag &&
new CleanWebpackPlugin( {
cleanAfterEveryBuildPatterns: [ '!fonts/**', '!images/**' ],
// Prevent it from deleting webpack assets during builds that have
// multiple configurations returned in the webpack config.
cleanStaleWebpackAssets: false,
} ),

new PhpFilePathsPlugin( {
context: getProjectSourcePath(),
props: [ 'render', 'variations' ],
Expand Down
1 change: 0 additions & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"browserslist": "^4.21.10",
"chalk": "^4.0.0",
"check-node-version": "^4.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^10.2.0",
"cross-spawn": "^7.0.6",
"css-loader": "^6.2.0",
Expand Down
Loading