woocommerce/plugins/woocommerce-admin/packages/dependency-extraction-webpa...
Chi-Hsuan Huang 9aba93d127 Update all js packages with minor/patch version changes (https://github.com/woocommerce/woocommerce-admin/pull/8392)
* Update all js packages with minor/patch version changes

* Add changelog

* Fix packages/data types errors

* Update data/CHANGELOG.md

* Fix puppeteer version

* Fix packages/data > countries error types

* Make data key optional in RestApiError
2022-03-08 10:11:12 +08:00
..
assets add: `@woocommerce/block-data` in Webpack deps extraction (https://github.com/woocommerce/woocommerce-admin/pull/7911) 2022-03-02 10:31:30 -06:00
src add: `@woocommerce/block-data` in Webpack deps extraction (https://github.com/woocommerce/woocommerce-admin/pull/7911) 2022-03-02 10:31:30 -06:00
.npmrc New Package: DependencyExtractionWebpackPlugin (https://github.com/woocommerce/woocommerce-admin/pull/5198) 2020-10-15 09:50:57 +13:00
CHANGELOG.md Update all js packages with minor/patch version changes (https://github.com/woocommerce/woocommerce-admin/pull/8392) 2022-03-08 10:11:12 +08:00
README.md Switch to pnpm (https://github.com/woocommerce/woocommerce-admin/pull/8349) 2022-03-04 12:01:16 +08:00
package.json Update all js packages with minor/patch version changes (https://github.com/woocommerce/woocommerce-admin/pull/8392) 2022-03-08 10:11:12 +08:00

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.