worldline-for-woocommerce
Last commit date
assets
3 months ago
inc
3 months ago
languages
3 months ago
modules
3 months ago
screenshots
3 months ago
shared
3 months ago
src
3 months ago
vendor
3 months ago
LICENSE
3 months ago
README.md
3 months ago
class-plugin.php
3 months ago
composer.json
3 months ago
config.php
3 months ago
package.json
3 months ago
readme.txt
3 months ago
tsconfig.json
3 months ago
uninstall.php
3 months ago
webpack.config.js
3 months ago
worldline-for-woocommerce.php
3 months ago
webpack.config.js
57 lines
| 1 | const defaultConfig = require('@wordpress/scripts/config/webpack.config'); |
| 2 | |
| 3 | const config = { |
| 4 | ...defaultConfig, |
| 5 | }; |
| 6 | |
| 7 | const modulesAssets = { |
| 8 | 'config': [ |
| 9 | 'backend/ts/main.ts', |
| 10 | ], |
| 11 | 'uninstall': [ |
| 12 | 'backend/ts/main.ts', |
| 13 | ], |
| 14 | 'checkout': [ |
| 15 | 'frontend/ts/main.ts', |
| 16 | ], |
| 17 | 'return-page': [ |
| 18 | 'frontend/ts/main.ts', |
| 19 | ], |
| 20 | 'hosted-tokenization-gateway': [ |
| 21 | 'frontend/ts/main.ts', |
| 22 | 'frontend/ts/blocks.tsx', |
| 23 | ], |
| 24 | 'worldline-payment-gateway': [ |
| 25 | 'backend/ts/main.ts', |
| 26 | ] |
| 27 | }; |
| 28 | |
| 29 | const entries = {}; |
| 30 | for (const [moduleId, assets] of Object.entries(modulesAssets)) { |
| 31 | for (let relativePath of assets) { |
| 32 | const name = moduleId + '-' + relativePath |
| 33 | .replace(/\.[tj]sx?$/g, '') |
| 34 | .split('/') |
| 35 | .filter(p => !['ts', 'js'].includes(p)) |
| 36 | .join('-'); |
| 37 | let fullModuleId = moduleId; |
| 38 | if (!fullModuleId.startsWith('worldline-')) { |
| 39 | fullModuleId = 'worldline-' + fullModuleId; |
| 40 | } |
| 41 | const path = `./modules/inpsyde/${fullModuleId}/resources/${relativePath}`; |
| 42 | |
| 43 | entries[name] = path; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | |
| 48 | module.exports = { |
| 49 | ...config, |
| 50 | entry: entries, |
| 51 | output: { |
| 52 | publicPath: './', |
| 53 | path: __dirname + '/assets', |
| 54 | filename: '[name].js', |
| 55 | } |
| 56 | }; |
| 57 |