global-payments-woocommerce
Last commit date
assets
1 year ago
includes
2 years ago
languages
1 year ago
resources
1 year ago
src
1 year ago
vendor
2 years ago
LICENSE
2 years ago
README.md
2 years ago
composer.json
1 year ago
composer.lock
2 years ago
globalpayments-gateway-provider-for-woocommerce.php
1 year ago
metadata.xml
1 year ago
package-lock.json
1 year ago
package.json
1 year ago
readme.txt
1 year ago
webpack.config.js
1 year ago
webpack.config.js
44 lines
| 1 | const defaultConfig = require('@wordpress/scripts/config/webpack.config'); |
| 2 | const WooCommerceDependencyExtractionWebpackPlugin = require('@woocommerce/dependency-extraction-webpack-plugin'); |
| 3 | const path = require('path'); |
| 4 | |
| 5 | const wcDepMap = { |
| 6 | '@woocommerce/blocks-registry': ['wc', 'wcBlocksRegistry'], |
| 7 | '@woocommerce/settings' : ['wc', 'wcSettings'] |
| 8 | }; |
| 9 | |
| 10 | const wcHandleMap = { |
| 11 | '@woocommerce/blocks-registry': 'wc-blocks-registry', |
| 12 | '@woocommerce/settings' : 'wc-settings' |
| 13 | }; |
| 14 | |
| 15 | const requestToExternal = (request) => { |
| 16 | if (wcDepMap[request]) { |
| 17 | return wcDepMap[request]; |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | const requestToHandle = (request) => { |
| 22 | if (wcHandleMap[request]) { |
| 23 | return wcHandleMap[request]; |
| 24 | } |
| 25 | }; |
| 26 | |
| 27 | module.exports = { |
| 28 | ...defaultConfig, |
| 29 | entry: { |
| 30 | 'gateways': '/resources/js/frontend/gateways/index.js', |
| 31 | }, |
| 32 | output: { |
| 33 | path: path.resolve( __dirname, 'assets/frontend/blocks' ), |
| 34 | filename: '[name].js', |
| 35 | }, |
| 36 | plugins: [ |
| 37 | new WooCommerceDependencyExtractionWebpackPlugin({ |
| 38 | injectPolyfill: true, |
| 39 | requestToExternal, |
| 40 | requestToHandle |
| 41 | }) |
| 42 | ] |
| 43 | } |
| 44 |