feat: update CopyAssetsPlugin to exclude fonts during asset copying
This commit is contained in:
@@ -64,12 +64,20 @@ class GitHashJsonPlugin {
|
||||
const CopyAssetsPlugin = {
|
||||
apply: (compiler) => {
|
||||
compiler.hooks.afterEmit.tap('CopyAssetsPlugin', () => {
|
||||
// Copy assets directory
|
||||
// Copy assets directory but exclude fonts (webpack handles fonts with hashed names)
|
||||
const assetsSrc = path.resolve(__dirname, 'public/assets');
|
||||
const assetsDest = path.resolve(__dirname, 'dist/assets');
|
||||
try {
|
||||
cpSync(assetsSrc, assetsDest, { recursive: true });
|
||||
console.log('Assets copied successfully');
|
||||
// Copy all assets except fonts
|
||||
const items = fs.readdirSync(assetsSrc);
|
||||
for (const item of items) {
|
||||
if (item !== 'fonts') {
|
||||
const srcPath = path.join(assetsSrc, item);
|
||||
const destPath = path.join(assetsDest, item);
|
||||
cpSync(srcPath, destPath, { recursive: true });
|
||||
}
|
||||
}
|
||||
console.log('Assets copied successfully (fonts excluded - handled by webpack)');
|
||||
} catch (err) {
|
||||
console.error('Error copying assets:', err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user