2db29164f9
* Update to pnpm 9.1 and fix a mini css bug * Add changefile(s) from automation for the following project(s): @woocommerce/tracks, @woocommerce/product-editor, @woocommerce/onboarding, @woocommerce/number, @woocommerce/notices, @woocommerce/navigation, @woocommerce/internal-js-tests, @woocommerce/extend-cart-checkout-block, @woocommerce/expression-evaluation, @woocommerce/explat, @woocommerce/experimental, @woocommerce/eslint-plugin, @woocommerce/dependency-extraction-webpack-plugin, @woocommerce/date, @woocommerce/data, @woocommerce/customer-effort-score, @woocommerce/currency, @woocommerce/csv-export, @woocommerce/create-woo-extension, @woocommerce/create-product-editor-block, @woocommerce/components, @woocommerce/api, @woocommerce/ai, @woocommerce/admin-e2e-tests, woocommerce-blocks, woocommerce-beta-tester, woocommerce, woo-ai * temporarily disable swallowing build output to diagnose issue with perf workflow * Ignore some type issues that commonly resurface when deps slightly change * Fix persistent type issues that have recurred many times * Add more ignores * Fix lint issue * Revert change to swallow build error * Improve access of the config that needs updated build dir. --------- Co-authored-by: github-actions <github-actions@github.com> |
||
---|---|---|
.. | ||
assets | ||
changelog | ||
src | ||
.eslintrc.js | ||
.npmrc | ||
CHANGELOG.md | ||
PREVIOUS_CHANGELOG.md | ||
README.md | ||
composer.json | ||
composer.lock | ||
package.json |
README.md
Dependency Extraction Webpack Plugin
Extends Wordpress Dependency Extraction Webpack Plugin to automatically include WooCommerce dependencies in addition to WordPress dependencies.
Installation
Install the module
pnpm install @woocommerce/dependency-extraction-webpack-plugin --save-dev
Usage
Use this as you would Dependency Extraction Webpack Plugin. The API is exactly the same, except that WooCommerce packages are also handled automatically.
// webpack.config.js
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
module.exports = {
// …snip
plugins: [ new WooCommerceDependencyExtractionWebpackPlugin() ],
};
Additional module requests on top of Wordpress Dependency Extraction Webpack Plugin are:
Request | Global | Script handle | Notes |
---|---|---|---|
@woocommerce/data |
wc['data'] |
wc-store-data |
|
@woocommerce/csv-export |
wc['csvExport'] |
wc-csv |
|
@woocommerce/blocks-registry |
wc['wcBlocksRegistry'] |
wc-blocks-registry |
|
@woocommerce/block-data |
wc['wcBlocksData'] |
wc-blocks-data-store |
This dependency does not have an associated npm package |
@woocommerce/settings |
wc['wcSettings'] |
wc-settings |
|
@woocommerce/* |
wc['*'] |
wc-* |
Options
An object can be passed to the constructor to customize the behavior, for example:
module.exports = {
plugins: [
new WooCommerceDependencyExtractionWebpackPlugin( {
bundledPackages: [ '@woocommerce/components' ],
} ),
],
};
bundledPackages
- Type: array
- Default: []
A list of potential WooCommerce excluded packages, this will include the excluded package within the bundle (example above).
For more supported options see the original dependency extraction plugin.