Skip to content

fix: resolve paths in config - #84

Merged
lukeed merged 2 commits into
mainfrom
fix/config-paths
Oct 23, 2026
Merged

lukeed merged 2 commits into
mainfrom
fix/config-paths

Conversation

@lukeed

@lukeed lukeed commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

tsconfig paths aliases did not work in the config, data modules, partials, or content data modules. loadModule() marked each bare id, such as ~/lib/menu, as an external package, so the import failed at run time with Cannot find package '~'. Scripts were not affected, since they do not use this plugin.

Changes

  • When no node_modules folder above the importer has a package of that name, the packages plugin asks Rolldown's resolver, which applies paths. A result outside node_modules is local code, and is bundled like a relative import.
  • link() is split in two: installed() finds the node_modules entry, and link() reads its symlink. An installed package never reaches the new resolve, so bongo itself stays one copy when it is linked.
  • Docs: one line in config.md.

Benchmark

loadModule() from main and from this branch, in one process, 40 alternating runs after 5 warm-up runs, M1 Max. Times in ms:

config main median / p90 branch median / p90
bench/site 2.69 / 3.15 2.73 / 3.16
docs 4.55 / 5.05 4.60 / 4.95
8 installed packages 1.42 / 1.57 1.43 / 1.71

The differences are within noise: an installed package does not resolve again. When the new path runs, 8 alias imports take 1.84 ms median, and the same 8 imports as relative paths take 1.78 ms.

Full bench

bun bench/index.ts site --runs 5, 6 pairs, alternating: main first in pairs 1–3, the branch first in pairs 4–6. Wall is the median of 5 fresh builds of 10,000 pages; the config stage is from the profile run.

pair main wall branch wall main config stage branch config stage
1 2.32 s 2.42 s 45 ms 48 ms
2 2.21 s 2.22 s 44 ms 46 ms
3 2.20 s 2.18 s 46 ms 44 ms
4 2.20 s 2.22 s 47 ms 44 ms
5 2.21 s 2.21 s 44 ms 46 ms
6 2.21 s 2.21 s 45 ms 46 ms

Neither side is faster in every pair. Pair 1 is the outlier: its branch runs spread from 2.20 s to 2.77 s. Every run wrote the same output, sha256 71e146856b298c20.

Test plan

  • bun test (853 pass), bunx tsc -p ., bunx tsc -p build, bun run build
  • The new build() test fails on main: the config, a data module, a partial, and a content data module each import through ~/
  • The test "bongo itself stays a package, even when it is linked" caught a first version that resolved before the node_modules check
  • By hand: a config that imports ~/t builds with the CLI

@lukeed
lukeed merged commit 57c5e26 into main Oct 23, 2026
4 checks passed
@lukeed
lukeed deleted the fix/config-paths branch October 23, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant