-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
48 lines (44 loc) · 1.7 KB
/
webpack.config.js
File metadata and controls
48 lines (44 loc) · 1.7 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require( 'path' );
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
const { getDokanLitePath } = require( './src/utils/dokan-path' );
const liteLocation = getDokanLitePath();
const { requestToExternal, requestToHandle } = require(
`../${ liteLocation }/webpack-dependency-mapping`
);
const updatedConfig = {
...defaultConfig,
entry: {
customers: './src/features/customers/index.jsx',
withdraw: './src/features/withdraw/index.jsx',
'store-seo': './src/features/store-seo/index.jsx',
'admin-vendors': './src/features/admin-vendors/index.jsx',
},
output: {
...defaultConfig.output,
path: path.resolve( __dirname, './assets/js' ),
filename: '[name].js',
clean: true,
},
externals: {
jquery: 'jQuery',
'@woocommerce/blocks-registry': [ 'wc', 'wcBlocksRegistry' ],
'@woocommerce/settings': [ 'wc', 'wcSettings' ],
'@woocommerce/block-data': [ 'wc', 'wcBlocksData' ],
'@woocommerce/shared-context': [ 'wc', 'wcSharedContext' ],
'@woocommerce/shared-hocs': [ 'wc', 'wcSharedHocs' ],
'@woocommerce/price-format': [ 'wc', 'priceFormat' ],
'@woocommerce/blocks-checkout': [ 'wc', 'blocksCheckout' ],
},
plugins: [
...defaultConfig.plugins.filter(
( plugin ) =>
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
),
new DependencyExtractionWebpackPlugin( {
requestToExternal,
requestToHandle,
} ),
],
};
module.exports = updatedConfig;