Images in versioned content are never resolved; versioned example build fails with missing 'images' export

Open
#155 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript, vite

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.

Description

Problem

Two related symptoms, one root cause:

  1. chronicle build --config examples/versioned/chronicle.yaml fails on main:
[MISSING_EXPORT] Error: "images" is not exported by "examples/versioned/versions/v1/dev/index.mdx"
  1. Images referenced from versioned content (versions/v1/docs/*.mdx etc.) 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.

Dominant language
TypeScript
Stars
2
Forks
1
Avg merge
12h 29m
Merged PRs (30d)
12

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raystack/chronicle

All issues in raystack/chronicle

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.