Skip to content

Every build compiles the registry twice #131

Description

@maehr

Problem

Every build compiles the registry twice.

astro.config.mjs calls buildNoindexPredicate() while Astro loads the config. Astro loads the config in a module graph that is separate from the page modules, so the cached memo in src/lib/registry.ts is not shared. compileRegistry therefore runs once for the config and once for the pages.

Instrumenting compileRegistry and running npx astro build prints the marker twice.

Why it matters

One compileRegistry() call on the real data takes about 2.65 s and materialises 86,397 records. The duplicate pass adds that time and a second in-memory copy to every build and to every astro dev start.

Suggested fix

Build the predicate lazily inside the sitemap filter callback, or share one compiled registry between the config and the pages.

Found during review of #127. Not caused by that PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions