mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 21:32:05 +00:00
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { describe } from "bun:test";
|
|
import { itBundled } from "./expectBundled";
|
|
|
|
describe("bundler", () => {
|
|
describe("compile with splitting", () => {
|
|
itBundled("compile/splitting/RelativePathsAcrossChunks", {
|
|
compile: true,
|
|
splitting: true,
|
|
backend: "cli",
|
|
files: {
|
|
"/src/app/entry.ts": /* js */ `
|
|
console.log('app entry');
|
|
import('../components/header').then(m => m.render());
|
|
`,
|
|
"/src/components/header.ts": /* js */ `
|
|
export async function render() {
|
|
console.log('header rendering');
|
|
const nav = await import('./nav/menu');
|
|
nav.show();
|
|
}
|
|
`,
|
|
"/src/components/nav/menu.ts": /* js */ `
|
|
export async function show() {
|
|
console.log('menu showing');
|
|
const items = await import('./items');
|
|
console.log('items:', items.list);
|
|
}
|
|
`,
|
|
"/src/components/nav/items.ts": /* js */ `
|
|
export const list = ['home', 'about', 'contact'].join(',');
|
|
`,
|
|
},
|
|
entryPoints: ["/src/app/entry.ts"],
|
|
outdir: "/build",
|
|
run: {
|
|
stdout: "app entry\nheader rendering\nmenu showing\nitems: home,about,contact",
|
|
},
|
|
});
|
|
});
|
|
});
|