Refactor webpack configuration to copy index.html to payment directory, enhancing clarity in log messages and ensuring proper directory structure for asset management.

This commit is contained in:
sebseb7
2025-07-15 13:06:06 +02:00
parent d8c802c2f1
commit 88c757fd35

View File

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