worldline-for-woocommerce
Last commit date
assets
1 week ago
inc
1 week ago
languages
1 week ago
modules
1 week ago
shared
1 week ago
src
1 week ago
vendor
1 week ago
.eslintrc.js
1 week ago
BUILD_INFO.txt
1 week ago
LICENSE
1 week ago
SECURITY.md
1 week ago
class-plugin.php
1 week ago
composer.json
1 week ago
config.php
1 week ago
package.json
1 week ago
readme.txt
1 week ago
tsconfig.json
1 week ago
uninstall.php
1 week ago
webpack.config.js
1 week ago
worldline-for-woocommerce.php
1 week ago
webpack.config.js
60 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 | 'admin-actions': [ |
| 28 | 'frontend/ts/main.ts', |
| 29 | ], |
| 30 | }; |
| 31 | |
| 32 | const entries = {}; |
| 33 | for (const [moduleId, assets] of Object.entries(modulesAssets)) { |
| 34 | for (let relativePath of assets) { |
| 35 | const name = moduleId + '-' + relativePath |
| 36 | .replace(/\.[tj]sx?$/g, '') |
| 37 | .split('/') |
| 38 | .filter(p => !['ts', 'js'].includes(p)) |
| 39 | .join('-'); |
| 40 | let fullModuleId = moduleId; |
| 41 | if (!fullModuleId.startsWith('worldline-')) { |
| 42 | fullModuleId = 'worldline-' + fullModuleId; |
| 43 | } |
| 44 | const path = `./modules/inpsyde/${fullModuleId}/resources/${relativePath}`; |
| 45 | |
| 46 | entries[name] = path; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | |
| 51 | module.exports = { |
| 52 | ...config, |
| 53 | entry: entries, |
| 54 | output: { |
| 55 | publicPath: './', |
| 56 | path: __dirname + '/assets', |
| 57 | filename: '[name].js', |
| 58 | } |
| 59 | }; |
| 60 |