@wordpress/dependency-extraction-webpack-plugin
Advanced tools
Comparing version 3.0.1 to 3.0.2-next.53e2173694.0
@@ -6,14 +6,14 @@ import { Compiler } from 'webpack'; | ||
declare class DependencyExtractionWebpackPlugin { | ||
constructor(options: DependencyExtractionWebpackPluginOptions); | ||
apply(compiler: Compiler): void; | ||
constructor( options: DependencyExtractionWebpackPluginOptions ); | ||
apply( compiler: Compiler ): void; | ||
} | ||
declare interface DependencyExtractionWebpackPluginOptions { | ||
injectPolyfill?: boolean; | ||
useDefaults?: boolean; | ||
outputFormat?: 'php' | 'json'; | ||
requestToExternal?: (request: string) => string | string[] | undefined; | ||
requestToHandle?: (request: string) => string | undefined; | ||
combinedOutputFile?: string | null; | ||
combineAssets?: boolean; | ||
injectPolyfill?: boolean; | ||
useDefaults?: boolean; | ||
outputFormat?: 'php' | 'json'; | ||
requestToExternal?: ( request: string ) => string | string[] | undefined; | ||
requestToHandle?: ( request: string ) => string | undefined; | ||
combinedOutputFile?: string | null; | ||
combineAssets?: boolean; | ||
} |
{ | ||
"name": "@wordpress/dependency-extraction-webpack-plugin", | ||
"version": "3.0.1", | ||
"version": "3.0.2-next.53e2173694.0", | ||
"description": "Extract WordPress script dependencies from webpack bundles.", | ||
@@ -41,3 +41,3 @@ "author": "The WordPress Contributors", | ||
}, | ||
"gitHead": "c79ef3aaa212f328a7d45f02018c21c94aa0965c" | ||
"gitHead": "cac63ac5e871791c3ea5bc6a5a7dd06d6229cccb" | ||
} |
@@ -6,7 +6,5 @@ # Dependency Extraction Webpack Plugin | ||
- Externalize dependencies that are available as script dependencies on modern WordPress sites. | ||
- Add an asset file for each entry point that declares an object with the list of WordPress script dependencies for the | ||
entry point. The asset file also contains the current version calculated for the current source code. | ||
- Add an asset file for each entry point that declares an object with the list of WordPress script dependencies for the entry point. The asset file also contains the current version calculated for the current source code. | ||
This allows JavaScript bundles produced by webpack to leverage WordPress style dependency sharing | ||
without an error-prone process of manually maintaining a dependency list. | ||
This allows JavaScript bundles produced by webpack to leverage WordPress style dependency sharing without an error-prone process of manually maintaining a dependency list. | ||
@@ -41,5 +39,3 @@ Consult the [webpack website](https://webpack.js.org) for additional information on webpack concepts. | ||
**Note:** Multiple instances of the plugin are not supported and may produced unexpected results. If | ||
you plan to extend the webpack configuration from `@wordpress/scripts` with your own `DependencyExtractionWebpackPlugin`, be sure to | ||
remove the default instance of the plugin: | ||
**Note:** Multiple instances of the plugin are not supported and may produced unexpected results. If you plan to extend the webpack configuration from `@wordpress/scripts` with your own `DependencyExtractionWebpackPlugin`, be sure to remove the default instance of the plugin: | ||
@@ -93,11 +89,5 @@ ```js | ||
**Note:** This plugin overlaps with the functionality provided by [webpack | ||
`externals`](https://webpack.js.org/configuration/externals). This plugin is intended to extract | ||
script handles from bundle compilation so that a list of script dependencies does not need to be | ||
manually maintained. If you don't need to extract a list of script dependencies, use the `externals` | ||
option directly. | ||
**Note:** This plugin overlaps with the functionality provided by [webpack `externals`](https://webpack.js.org/configuration/externals). This plugin is intended to extract script handles from bundle compilation so that a list of script dependencies does not need to be manually maintained. If you don't need to extract a list of script dependencies, use the `externals` option directly. | ||
This plugin is compatible with `externals`, but they may conflict. For example, adding | ||
`{ externals: { '@wordpress/blob': 'wp.blob' } }` to webpack configuration will effectively hide the | ||
`@wordpress/blob` module from the plugin and it will not be included in dependency lists. | ||
This plugin is compatible with `externals`, but they may conflict. For example, adding `{ externals: { '@wordpress/blob': 'wp.blob' } }` to webpack configuration will effectively hide the `@wordpress/blob` module from the plugin and it will not be included in dependency lists. | ||
@@ -149,4 +139,3 @@ #### Options | ||
Force `wp-polyfill` to be included in each entry point's dependency list. This would be the same as | ||
adding `import '@wordpress/polyfill';` to each entry point. | ||
Force `wp-polyfill` to be included in each entry point's dependency list. This would be the same as adding `import '@wordpress/polyfill';` to each entry point. | ||
@@ -157,8 +146,5 @@ ##### `requestToExternal` | ||
`requestToExternal` allows the module handling to be customized. The function should accept a | ||
module request string and may return a string representing the global variable to use. An array of | ||
strings may be used to access globals via an object path, e.g. `wp.i18n` may be represented as `[ 'wp', 'i18n' ]`. | ||
`requestToExternal` allows the module handling to be customized. The function should accept a module request string and may return a string representing the global variable to use. An array of strings may be used to access globals via an object path, e.g. `wp.i18n` may be represented as `[ 'wp', 'i18n' ]`. | ||
`requestToExternal` provided via configuration has precedence over default external handling. | ||
Unhandled requests will be handled by the default unless `useDefaults` is set to `false`. | ||
`requestToExternal` provided via configuration has precedence over default external handling. Unhandled requests will be handled by the default unless `useDefaults` is set to `false`. | ||
@@ -220,7 +206,8 @@ ```js | ||
The functions `requestToExternal` and `requestToHandle` allow this module to handle arbitrary | ||
modules. `requestToExternal` is necessary to handle any module and maps a module request to a global | ||
name. `requestToHandle` maps the same module request to a script handle, the strings that will be | ||
included in the `entrypoint.asset.php` files. | ||
The functions `requestToExternal` and `requestToHandle` allow this module to handle arbitrary modules. | ||
`requestToExternal` is necessary to handle any module and maps a module request to a global name. | ||
`requestToHandle` maps the same module request to a script handle, the strings that will be included in the `entrypoint.asset.php` files. | ||
### WordPress | ||
@@ -227,0 +214,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
39703
1
222