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:
@@ -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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user