1e35d45c99
* Update unit tests to handle _templateBlockId and _templateBlockOrder * Refactor get_formatted_template * Initial @woocommerce/block-templates package * Add block-templates to admin webpack * Add block-templates to dependency-extraction-webpack-plugin * Add block-templates to admin assets * Add block-templates dependency * Update name block * Update syncpack * Update regular price block * Update tab block * Update section block * Add @wordpress/deprecated to package * Deprecated initBlock * Update attributes block * Update catalog visibility block * Update checkbox block * Update conditional block * Update collapsible block * Allow additional props to be passed to useWooBlockProps * Update inventory sku block * Update inventory quantity block * Update inventory email block * Update images block * Update description block * Update radio block * Update pricing block * Update password block * Update notice block * Update shipping dimensions block * Update shipping class block * Update schedule sale block * Update sale price block * Update toggle block * Update taxonomy block * Update tag block * Update summary block * Update variations block * Update variations options block * Update variation items blocks * Changelog * Changelog * Changelog * Changelog * Changelog * Add test for registerWooBlockType * Add @testing-library/react-hooks to devDependencies * Add test for useWooBlockProps * Document API * Fix linting issues in README.md * Fix tabs tests by mocking useWooBlockProps * Allow header duplication under different nesting * Remove unused import (fixes lint error) * Update lock file |
||
---|---|---|
.. | ||
assets | ||
changelog | ||
src | ||
.eslintrc.js | ||
.gitignore | ||
.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.