generated from jrtashjian/pluginwp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
35 lines (31 loc) · 904 Bytes
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* WordPress dependencies.
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const { camelCaseDash } = require( '@wordpress/dependency-extraction-webpack-plugin/lib/util' );
/**
* Internal dependencies.
*/
const { dependencies } = require( './package' );
const PLUGIN_NAMESPACE = '@omniform/';
const pluginPackages = Object.keys( dependencies )
.filter( ( packageName ) => packageName.startsWith( PLUGIN_NAMESPACE ) )
.map( ( packageName ) => packageName.replace( PLUGIN_NAMESPACE, '' ) );
module.exports = {
...defaultConfig,
entry: {
...pluginPackages.reduce( ( memo, packageName ) => {
return {
...memo,
[ `${ packageName }/index` ]: {
import: `./packages/${ packageName }`,
library: {
name: [ 'omniform', camelCaseDash( packageName ) ],
type: 'window',
},
},
};
}, {} ),
...defaultConfig.entry(),
},
};