Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error when using experimental.contentCollectionCache with square brackets in file name. #9210

Closed
1 task
Tc-001 opened this issue Nov 28, 2023 · 2 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) cached build

Comments

@Tc-001
Copy link
Contributor

Tc-001 commented Nov 28, 2023

Astro Info

Astro                    v3.6.1
Node                     v18.17.1
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         @astrojs/sitemap

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

Firefox

Describe the Bug

When building a site with experimental.contentCollectionCache, the builder will crash if there is [something] in square brackets in file or folder name.

Repro:

  • pnpm create astro@latest -- --template blog
  • Enable experimental.contentCollectionCache in config
  • Rename src/content/blog/first-post.md to src/content/blog/first-post[test].md
  • pnpm build

You should get an error:

16:05:32 [build] Building static entrypoints...
"[Test]" is not a valid placeholder in the "output.entryFileNames" pattern.
 error   "[Test]" is not a valid placeholder in the "output.entryFileNames" pattern.
  File:
    /home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2287:30
  Code:
    2286 |     if (!(base instanceof Error)) {
    > 2287 |         base = Object.assign(new Error(base.message), base);
           |                              ^
      2288 |         Object.defineProperty(base, 'name', { value: 'RollupError' });
      2289 |     }
      2290 |     throw base;
  Stacktrace:
RollupError: "[Test]" is not a valid placeholder in the "output.entryFileNames" pattern.
    at error (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
    at file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:15668:20
    at String.replace (<anonymous>)
    at renderNamePattern (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:15666:20)
    at Chunk.getPreliminaryFileName (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:15965:24)
    at reserveEntryChunksInBundle (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17695:19)
    at renderChunks (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17681:5)
    at Bundle.generate (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17922:19)
    at async file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:26785:27
    at async catchUnfinishedHookActions (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:25910:16)
    at async Module.build (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:48085:22)
    at async ssrBuild (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/core/build/static-build.js:208:10)
    at async viteBuild (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/core/build/static-build.js:57:21)
    at async AstroBuilder.build (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/core/build/index.js:133:27)
    at async AstroBuilder.run (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/core/build/index.js:165:7)
    at async build (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/core/build/index.js:44:3)
    at async build (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/cli/build/index.js:21:3)
    at async runCommand (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/cli/index.js:116:7)
    at async cli (file:///home/me/Documents/Projects/temp/stale-singularity/node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/cli/index.js:144:5)

 ELIFECYCLE  Command failed with exit code 1.

What's the expected result?

The site should build without issues

Link to Minimal Reproducible Example

https://git.t0.lv/Tc001/astro-contentCollectionCache-repro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 28, 2023
@natemoo-re
Copy link
Member

Ahh that's a good one that I wouldn't have caught! Thanks for filing. As soon as 4.0.0 is out the door I'll be back on fixes for this flagged behavior.

@natemoo-re natemoo-re added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Nov 28, 2023
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Nov 28, 2023
@Princesseuh Princesseuh added - P3: minor bug An edge case that only affects very specific usage (priority) and removed - P4: important Violate documented behavior or significantly impacts performance (priority) labels Feb 14, 2024
@ascorbic
Copy link
Contributor

ascorbic commented Oct 2, 2024

Experimental content collections cache has been removed from Astro, so I'm going to close this.

@ascorbic ascorbic closed this as completed Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) cached build
Projects
None yet
Development

No branches or pull requests

4 participants