contentlayerdev / contentlayerdev/contentlayer

Internal: Performance improvements for `getConfig`

Open
#158 1 comment 0 reactions 0 assignees View on GitHub
meta: never-stale topic: performance
Dominant language
TypeScript
Stars
3.5k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

`getConfig` is currently a performance bottleneck and should be improved if possible.

Some ideas:

- Short-circuit esbuild generation if "nothing has changed"
- Do "optimistic file-checks" i.e. only check for file existence as part of error handling path to not slow down the critical path (e.g. when checking for existence of `contentlayer.config.ts`)
- Resolve Contentlayer version at compile time instead of dynamically
- Investigate ways to speed up the `import-compiled-contentlayer-config` step

image

Contributor guide

Open the contributing guide

Research direction

Start by profiling getConfig, especially the import-compiled-contentlayer-config step and checks involving contentlayer.config.ts. Compare runs when configuration is unchanged and when error handling is triggered. Done means a measured improvement to the bottleneck while preserving existing configuration generation and error behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
performance, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.