Commit c6fe3d2930 for woocommerce
commit c6fe3d29301471f7f1cc563075786d6648e9315e
Author: Luigi Teschio <gigitux@gmail.com>
Date: Thu Apr 17 09:38:07 2025 +0200
Update README.md to include instructions for extending webpack configuration with `WooCommerceDependencyExtractionWebpackPlugin` (#57314)
Update README.md to include instructions for extending webpack configuration with WooCommerceDependencyExtractionWebpackPlugin
diff --git a/packages/js/dependency-extraction-webpack-plugin/README.md b/packages/js/dependency-extraction-webpack-plugin/README.md
index d9ff355458..8aae2940b9 100644
--- a/packages/js/dependency-extraction-webpack-plugin/README.md
+++ b/packages/js/dependency-extraction-webpack-plugin/README.md
@@ -24,6 +24,22 @@ module.exports = {
};
```
+**Note:** If you plan to extend the webpack configuration from `@wordpress/scripts` with `WooCommerceDependencyExtractionWebpackPlugin`, be sure to remove the default instance of the plugin:
+
+```js
+const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
+const webpackConfig = {
+ ...defaultConfig,
+ plugins: [
+ ...defaultConfig.plugins.filter(
+ ( plugin ) =>
+ plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
+ ),
+ new WooCommerceDependencyExtractionWebpackPlugin(),
+ ],
+};
+```
+
Additional module requests on top of Wordpress [Dependency Extraction Webpack Plugin](https://github.com/WordPress/gutenberg/tree/trunk/packages/dependency-extraction-webpack-plugin) are:
| Request | Global | Script handle | Notes |