Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# bedrock-webpack ChangeLog

## 11.4.0 - 2025-09-dd

### Changed
- Replace `clean-webpack-plugin` with webpack 5.20+ built-in `CleanPlugin`.

## 11.3.0 - 2025-08-25

### Changed
Expand Down
21 changes: 13 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import webpack from 'webpack';
import {merge as webpackMerge} from 'webpack-merge';

// webpack plugins
import {CleanWebpackPlugin} from 'clean-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import StatsPlugin from 'stats-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
Expand Down Expand Up @@ -256,12 +255,18 @@ export async function bundle(options = {}) {
webpackDefinePlugin.push(new webpack.DefinePlugin(defines));

// clean mode
const webpackCleanPlugin = [];
const webpackCleanOptions = {};
if(command.webpackClean === 'true') {
const opts = {
verbose: command.webpackCleanVerbose === 'true'
};
webpackCleanPlugin.push(new CleanWebpackPlugin(opts));
if(command.webpackCleanVerbose === 'true') {
webpackCleanOptions.clean = {
keep(asset) {
console.warn(`clean-webpack-plugin: removed ${asset}`);
return false;
}
};
} else {
webpackCleanOptions.clean = true;
}
}

// html webpack plugin
Expand Down Expand Up @@ -291,7 +296,8 @@ export async function bundle(options = {}) {
output: {
path: path.join(paths.local, 'js'),
publicPath: path.join(paths.public, 'js/'),
filename: '[name].[hash].js'
filename: '[name].[hash].js',
...webpackCleanOptions
},
resolve: {
alias: {
Expand Down Expand Up @@ -417,7 +423,6 @@ export async function bundle(options = {}) {
plugins: [
...webpackHtmlPlugin,
...webpackDefinePlugin,
...webpackCleanPlugin,
new VueLoaderPlugin(),
...webpackProgressPlugin,
...webpackHmrPlugin
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@babel/preset-env": "^7.28.0",
"app-root-path": "^3.0.0",
"babel-loader": "^10.0.0",
"clean-webpack-plugin": "^4.0.0",
"core-js": "^3.45.1",
"css-loader": "^7.1.2",
"file-loader": "^6.2.0",
Expand Down