Images in versioned content are never resolved; versioned example build fails with missing 'images' export
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 12h 29m
- Merged PRs (30d)
- 12
Description
Problem
Two related symptoms, one root cause:
chronicle build --config examples/versioned/chronicle.yamlfails on main:
[MISSING_EXPORT] Error: "images" is not exported by "examples/versioned/versions/v1/dev/index.mdx"
- Images referenced from versioned content (
versions/v1/docs/*.mdxetc.) are never rewritten to/_content/URLs, so image resolution, optimization, and cache versioning (#154) all skip them.
Root cause
remark-resolve-images finds the content root by searching the file path for the literal segment /content/:
const contentIdx = filePath.lastIndexOf('/content/')
if (contentIdx === -1) return
The .content mirror symlinks individual files, and Vite resolves those symlinks to their real paths. For latest content the real path happens to contain /content/ (e.g. examples/basic/content/docs/page.mdx), so it works. For versioned content the real path is examples/versioned/versions/v1/docs/page.mdx — no /content/ segment — so the plugin returns early and never sets file.data.images.
Because vite-config.ts uses valueToExport: ['readingTime', 'images'] and source.ts imports images from every globbed MDX module, the missing value becomes a hard build failure.
This also means any project whose content directory is not literally named content gets no image resolution at all.
Repro
bun run build:cli
./packages/chronicle/bin/chronicle.js build --config examples/versioned/chronicle.yaml
# 4x MISSING_EXPORT errors
Suggested fix
Stop inferring the content root from the path string. The plugin (or the MDX pipeline setup in vite-config.ts) already knows the real content roots from the chronicle config / .content mirror mapping, so pass them in as plugin options and match file paths against them. Always set file.data.images (even when empty) so the images export is guaranteed.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with remark-resolve-images and the MDX pipeline setup in vite-config.ts, then inspect source.ts where images is imported from globbed modules. Reproduce with the versioned chronicle.yaml build command and trace the .content mirror paths. Done means versioned builds succeed, images exports are always present, and versioned image paths are resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100