1.0.0 • Published 1 year ago

@content-control/dependency-extraction-webpack-plugin v1.0.0

Weekly downloads
-
License
GPL-2.0-or-later
Repository
github
Last release
1 year ago

Dependency Extraction Webpack Plugin

Extends Wordpress Dependency Extraction Webpack Plugin to automatically include Content Control dependencies in addition to WordPress dependencies.

Installation

Install the module

pnpm install @content-control/dependency-extraction-webpack-plugin --save-dev

Usage

Use this as you would Dependency Extraction Webpack Plugin. The API is exactly the same, except that Content Control packages are also handled automatically.

// webpack.config.js
const ContentControlDependencyExtractionWebpackPlugin = require( '@content-control/dependency-extraction-webpack-plugin' );

module.exports = {
	// …snip
	plugins: [ new ContentControlDependencyExtractionWebpackPlugin() ],
};

Additional module requests on top of Wordpress Dependency Extraction Webpack Plugin are:

RequestGlobalScript handleNotes
@content-control/componentscontentControl['components']content-control-components
@content-control/core-datacontentControl['coreData']content-control-core-data
@content-control/datacontentControl['data']content-control-data
@content-control/fieldscontentControl['fields']content-control-fields
@content-control/rule-enginecontentControl['ruleEngine']content-control-rule-engine
@content-control/*contentControl['*']content-control-*

Options

An object can be passed to the constructor to customize the behavior, for example:

module.exports = {
	plugins: [
		new ContentControlDependencyExtractionWebpackPlugin( {
			bundledPackages: [ '@content-control/components' ],
		} ),
	],
};
bundledPackages
  • Type: array
  • Default: []

A list of potential Content Control excluded packages, this will include the excluded package within the bundle (example above).

For more supported options see the original dependency extraction plugin.