Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update dependency extraction naming
  • Loading branch information
louwie17 committed May 26, 2021
commit 23c2cd1229a9e000562e97b88267b12d4c342ccd
4 changes: 4 additions & 0 deletions packages/dependency-extraction-webpack-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

- Add new `bundledPackages` option to bundle in specific packages.

# 1.5.0

- Add `@woocommerce/explat` to list of packages.
Expand Down
6 changes: 3 additions & 3 deletions packages/dependency-extraction-webpack-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ An object can be passed to the constructor to customize the behavior, for exampl
module.exports = {
plugins: [
new WooCommerceDependencyExtractionWebpackPlugin( {
excludedExternals: [ 'components' ],
bundledPackages: [ '@woocommerce/components' ],
} ),
],
};
```

##### `excludedExternals`
##### `bundledPackages`

- Type: array
- Default: []

A list of potential WooCommerce excluded packages, this will include the excluded package within the bundle.
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](https://github.com/WordPress/gutenberg/blob/trunk/packages/dependency-extraction-webpack-plugin/README.md#options).
4 changes: 2 additions & 2 deletions packages/dependency-extraction-webpack-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const wooRequestToExternal = ( request, excludedExternals ) => {
settings: [ 'wc', 'wcSettings' ],
};

if ( ( excludedExternals || [] ).includes( handle ) ) {
if ( ( excludedExternals || [] ).includes( request ) ) {
return;
}

Expand Down Expand Up @@ -69,7 +69,7 @@ class DependencyExtractionWebpackPlugin extends WPDependencyExtractionWebpackPlu
) {
externalRequest = wooRequestToExternal(
request,
this.options.excludedExternals || []
this.options.bundledPackages || []
);
}

Expand Down