Skip to content

Commit

Permalink
chore: simplify function
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherry committed Feb 23, 2024
1 parent 34aad9f commit 07cd3f1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/astro/src/core/build/plugins/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ export function shouldInlineAsset(
const result = assetsInlineLimit(assetPath, Buffer.from(assetContent));
if (result != null) {
return result;
} else {
return Buffer.byteLength(assetContent) < 4096; // Fallback to 4096kb by default (same as Vite)
}
}
if (typeof assetsInlineLimit === 'number' || typeof assetsInlineLimit === 'string') {
return Buffer.byteLength(assetContent) < Number(assetsInlineLimit);
}

return Buffer.byteLength(assetContent) < 4096; // Fallback to 4096kb by default (same as Vite)
return Buffer.byteLength(assetContent) < Number(assetsInlineLimit);
}

0 comments on commit 07cd3f1

Please sign in to comment.