feat: update CopyAssetsPlugin to exclude fonts during asset copying
This commit is contained in:
@@ -64,12 +64,20 @@ class GitHashJsonPlugin {
|
|||||||
const CopyAssetsPlugin = {
|
const CopyAssetsPlugin = {
|
||||||
apply: (compiler) => {
|
apply: (compiler) => {
|
||||||
compiler.hooks.afterEmit.tap('CopyAssetsPlugin', () => {
|
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 assetsSrc = path.resolve(__dirname, 'public/assets');
|
||||||
const assetsDest = path.resolve(__dirname, 'dist/assets');
|
const assetsDest = path.resolve(__dirname, 'dist/assets');
|
||||||
try {
|
try {
|
||||||
cpSync(assetsSrc, assetsDest, { recursive: true });
|
// Copy all assets except fonts
|
||||||
console.log('Assets copied successfully');
|
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) {
|
} catch (err) {
|
||||||
console.error('Error copying assets:', err);
|
console.error('Error copying assets:', err);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user