温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/bun/BuildOutput/metafile
点击访问原文链接

property metafile | Bun module | Bun

property metafile | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/BuildOutput/metafilePmetafile

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/BuildOutput/metafilePmetafile

property

BuildOutput.metafilemetafile?: BuildMetafile

Metadata about the build including inputs, outputs, and their relationships.

Only present when BuildConfig.metafile is true.

The metafile contains detailed information about:

inputs: All source files that were bundled, their byte sizes, imports, and formatoutputs: All generated output files, their byte sizes, which inputs contributed to each output, imports between chunks, and exports

This can be used for:

Bundle size analysis and visualizationDetecting unused code or dependenciesUnderstanding the dependency graphIntegration with bundle analyzer tools
const result = await Bun.build({
entrypoints: ['./src/index.ts'],
outdir: './dist',
metafile: true,
});

if (result.metafile) {
// Analyze input files
for (const [path, input] of Object.entries(result.metafile.inputs)) {
console.log(`${path}: ${input.bytes} bytes, ${input.imports.length} imports`);
}

// Analyze output files
for (const [path, output] of Object.entries(result.metafile.outputs)) {
console.log(`${path}: ${output.bytes} bytes`);
for (const [inputPath, info] of Object.entries(output.inputs)) {
console.log(` - ${inputPath}: ${info.bytesInOutput} bytes`);
}
}

// Write to disk for external analysis tools
await Bun.write('./dist/meta.json', JSON.stringify(result.metafile));
}

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

property metafile | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    Metadata about the build including inputs, outputs, and their relationships. Only present when BuildConfig.metafile is `true`. The metafile contains detailed information about: - **inputs**: All source files that were bundled, their byte sizes, imports, and format - **outputs**: All generated output files, their byte sizes, which inputs contributed to each output, imports between chunks, and exports This can be used for: - Bundle size analysis and visualization - Detecting unused code or dependencies - Understanding the dependency graph - Integration with bundle analyzer tools