feat(#1): add image loader capabilities

This commit is contained in:
Juan Sebastián Montoya 2024-07-11 00:44:13 -05:00
parent 07c5428f7c
commit 6e5966e79e
17 changed files with 104 additions and 45 deletions

View file

@ -15,16 +15,27 @@ export default function bundleSize({ file, maxSize = 13 }) {
);
for (const file in bundle) {
const { modules } = bundle[file];
for (const moduleName in modules) {
const module = modules[moduleName];
const name = path.basename(moduleName);
uncompressedSize += module.renderedLength;
if (bundle[file].type === 'chunk') {
for (const moduleName in modules) {
const module = modules[moduleName];
const name = path.basename(moduleName);
uncompressedSize += module.renderedLength;
console.log(
`${chalk.cyan(name.padEnd(30, " "))}\t ${chalk.cyan(
module.renderedLength
)}`
);
}
} else if (bundle[file].type === 'asset') {
const { size } = fs.statSync(file);
uncompressedSize += size;
console.log(
`${chalk.cyan(name.padEnd(30, " "))}\t ${chalk.cyan(
module.renderedLength
`${chalk.cyan(file.padEnd(30, " "))}\t ${chalk.cyan(
size
)}`
);
}
}
console.log(