@wordpress/library-export-default-webpack-plugin v2.14.0
Library Export Default Webpack Plugin
Webpack plugin for exporting default
property for selected libraries which use ES6 Modules. Implementation is based on the Webpack's core plugin ExportPropertyMainTemplatePlugin. The only difference is that this plugin allows to whitelist all entry point names where the default export of your entry point will be assigned to the library target.
Note: This plugin requires Webpack 4.0 and newer, and is not compatible with older versions.
Installation
Install the module
npm install @wordpress/library-export-default-webpack-plugin --save
Usage
Construct an instance of LibraryExportDefaultPlugin
in your Webpack configurations plugins entry, passing an array where values correspond to the entry point name.
The following example selects boo
entry point to be updated by the plugin. When compiled, the built file will ensure that default
value exported for the chunk will be assigned to the global variable wp.boo
. foo
chunk will remain untouched.
const LibraryExportDefaultPlugin = require( '@wordpress/library-export-default-webpack-plugin' );
module.exports = {
// ...
entry: {
boo: './packages/boo',
foo: './packages/foo',
},
output: {
filename: 'build/[name].js',
path: __dirname,
library: [ 'wp', '[name]' ],
libraryTarget: 'this',
},
plugins: [
new LibraryExportDefaultPlugin( [ 'boo' ] ),
],
}
7 months ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago