Update webpack configuration to copy index.html to payment/success/success, improving clarity in log messages for asset copying.

This commit is contained in:
sebseb7
2025-07-15 13:04:42 +02:00
parent 056b63efa0
commit d8c802c2f1

View File

@@ -87,16 +87,16 @@ const CopyAssetsPlugin = {
// Copy index.html to payment/success directory for callback // Copy index.html to payment/success directory for callback
const indexSrc = path.resolve(__dirname, 'dist/index.html'); const indexSrc = path.resolve(__dirname, 'dist/index.html');
const paymentSuccessDir = path.resolve(__dirname, 'dist/payment/success'); const paymentSuccessDir = path.resolve(__dirname, 'dist/payment/success');
const paymentSuccessDest = path.resolve(__dirname, 'dist/payment/success/index.html'); const paymentSuccessDest = path.resolve(__dirname, 'dist/payment/success/success');
try { try {
// Create payment/success directory if it doesn't exist // Create payment/success directory if it doesn't exist
if (!fs.existsSync(paymentSuccessDir)) { if (!fs.existsSync(paymentSuccessDir)) {
fs.mkdirSync(paymentSuccessDir, { recursive: true }); fs.mkdirSync(paymentSuccessDir, { recursive: true });
} }
cpSync(indexSrc, paymentSuccessDest); cpSync(indexSrc, paymentSuccessDest);
console.log('Index.html copied to payment/success successfully'); console.log('Index.html copied to payment/success/success successfully');
} catch (err) { } catch (err) {
console.error('Error copying index.html to payment/success:', err); console.error('Error copying index.html to payment/success/success:', err);
} }
}); });
}, },