In `@woocommerce/blocks-checkout` package documentation - reference WCDEWP instead of WPDEWP (https://github.com/woocommerce/woocommerce-blocks/pull/5154)
* Reference the WooCommerce DEWP instead of WPDEWP * Apply suggestions from code review Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com> Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
This commit is contained in:
parent
c2fb8751be
commit
620cf8aebc
|
@ -6,7 +6,7 @@ Components and utilities making it possible to integrate with the WooCommerce Ca
|
||||||
|
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [Aliased imports](#aliased-imports)
|
- [Aliased imports](#aliased-imports)
|
||||||
- [Folder Structure Overview](#folder-structure-overview)
|
- [Folder Structure Overview](#folder-structure-overview)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
@ -23,36 +23,22 @@ const { ... } = wc.blocksCheckout;
|
||||||
|
|
||||||
### Aliased imports
|
### Aliased imports
|
||||||
|
|
||||||
Alternatively, you can map this to external to a custom alias using the [WordPress Dependency Extraction Webpack Plugin](https://github.com/WordPress/gutenberg/tree/trunk/packages/dependency-extraction-webpack-plugin):
|
Alternatively, you can map this to externals (or aliases) using the [WooCommerce Dependency Extraction Webpack Plugin](https://github.com/woocommerce/woocommerce-admin/tree/main/packages/dependency-extraction-webpack-plugin). Just add the above Webpack plugin to your package.json:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @woocommerce/dependency-extraction-webpack-plugin --save-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, you can include this plugin in your Webpack configuration:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// webpack.config.js
|
// webpack.config.js
|
||||||
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
|
const WooCommerceDependencyExtractionWebpackPlugin = require( '@woocommerce/dependency-extraction-webpack-plugin' );
|
||||||
|
|
||||||
const dependencyMap = {
|
|
||||||
'@woocommerce/blocks-checkout': [ 'wc', 'blocksCheckout' ],
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleMap = {
|
|
||||||
'@woocommerce/blocks-checkout': 'wc-blocks-checkout',
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// …snip
|
// …snip
|
||||||
plugins: [
|
plugins: [
|
||||||
new DependencyExtractionWebpackPlugin( {
|
new WooCommerceDependencyExtractionWebpackPlugin(),
|
||||||
injectPolyfill: true,
|
|
||||||
requestToExternal( request ) {
|
|
||||||
if ( dependencyMap[ request ] ) {
|
|
||||||
return dependencyMap[ request ];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
requestToHandle( request ) {
|
|
||||||
if ( handleMap[ request ] ) {
|
|
||||||
return handleMap[ request ];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
} ),
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue