property files | Bun module | Bun
BuildDocsReferenceGuidesBlogDiscord/
Bun/
BuildConfig/
filesPfiles
Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/
Bun/
BuildConfig/
filesPfiles
property
BuildConfig.filesfiles?: Recordstring, string | ArrayBufferLike | TypedArrayArrayBufferLike> |
Blob>
A map of file paths to their contents for in-memory bundling.
This allows you to bundle virtual files that don't exist on disk, or override the contents of files that do exist on disk. The keys are file paths (which should match how they're imported) and the values are the file contents.
File contents can be provided as:
string - The source code as a stringBlob - A Blob containing the source codeNodeJS.TypedArray - A typed array (e.g., Uint8Array) containing the source codeArrayBufferLike - An ArrayBuffer containing the source code// Bundle entirely from memory (no files on disk needed)
await Bun.build({
entrypoints: ["/app/index.ts"],
files: {
"/app/index.ts": `
import { helper } from "./helper.ts";
console.log(helper());
`,
"/app/helper.ts": `
export function helper() {
return "Hello from memory!";
}
`,
},
});
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlog Toolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →