Skip to content

Extra content-assets.mjs and content-modules.mjs files are generated when building with an outDir outside of the project directory #14903

@Steffan153

Description

@Steffan153

Astro Info

Astro                    v5.16.0
Node                     v24.3.0
System                   macOS (arm64)
Package Manager          bun
Output                   static
Adapter                  none
Integrations             astro-compress
                         astro-meta-tags
                         @astrojs/sitemap
                         astro-critters
                         pagefind

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When running astro build and setting --outDir to a directory outside of the current project directory, these extra files get generated (both just containing export default new Map;).

Sometimes, also settings.json and data-store.json files get generated. Usually they don't, but occasionally they seem to show up as well.

None of these files show up when normally building into the dist folder, or building into a different folder inside the project folder. My project doesn't use content collections.

What's the expected result?

It should be consistent whether these files get generated or not.

Link to Minimal Reproducible Example

Any Astro project. I created an empty project on Stackblitz and reproduced like this:

Image

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: nice to haveNot breaking anything but nice to have (priority)feat: content collectionsRelated to the Content Collections feature (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions