Bun

Access content in Bun.

Setup

Register the plugin in preload script:

preload = ["./scripts/preload.ts"]
import { createMdxPlugin } from '@hanzo/docs/mdx/bun';

Bun.plugin(createMdxPlugin());

It will add support for loading MDX/meta files on runtime.

Now running any script with Bun, you can access your content files directly.

Re-generate .source folder

Optionally, you can re-generate the .source folder.

It is useful when the folder could be missing, or you are using Vite, which defaults to generating code with Vite-specific APIs.

preload.ts
import { postInstall } from '@hanzo/docs/mdx/next';

await postInstall({ configPath: 'source.config.ts' });
preload.ts
import { postInstall } from '@hanzo/docs/mdx/vite';

await postInstall({
  configPath: 'source.config.ts',
  index: {
    target: 'bun',
  },
});
How is this guide?