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

Unable to build Starlight documentation with Astro version >=2.6.4 #7397

Closed
1 task
HiDeoo opened this issue Jun 15, 2023 · 1 comment · Fixed by #7399
Closed
1 task

Unable to build Starlight documentation with Astro version >=2.6.4 #7397

HiDeoo opened this issue Jun 15, 2023 · 1 comment · Fixed by #7399
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@HiDeoo
Copy link
Member

HiDeoo commented Jun 15, 2023

What version of astro are you using?

2.6.4

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

Note: I am posting this issue in this repo as advised in the #starlight Discord channel as the issue seems to be related to an Astro regression.

With Starlight, when using an Astro version >=2.5.6, the build fails with the following error:

Invalid pattern "../node_modules/.pnpm/@astrojs+starlight@0.1.4_astro@2.5.6/node_modules/@astrojs/starlight/404.astro.mjs" for "output.entryFileNames", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.
 error   Invalid pattern "../node_modules/.pnpm/@astrojs+starlight@0.1.4_astro@2.5.6/node_modules/@astrojs/starlight/404.astro.mjs" for "output.entryFileNames", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.
RollupError: Invalid pattern "../node_modules/.pnpm/@astrojs+starlight@0.1.4_astro@2.5.6/node_modules/@astrojs/starlight/404.astro.mjs" for "output.entryFileNames", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.
    at error (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:2238:30)
    at renderNamePattern (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:15477:16)
    at Chunk.getPreliminaryFileName (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:15773:24)
    at reserveEntryChunksInBundle (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:17483:19)
    at renderChunks (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:17469:5)
    at Bundle.generate (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:17692:19)
    at async eval (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:26157:27)
    at async catchUnfinishedHookActions (file://file:///home/projects/github-kwocty/node_modules/.pnpm/rollup@3.25.1/node_modules/rollup/dist/es/shared/node-entry.js:25290:16)
    at async Module.build (file://file:///home/projects/github-kwocty/node_modules/.pnpm/vite@4.3.9/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:46529:22)
    at async ssrBuild (file://file:///home/projects/github-kwocty/node_modules/.pnpm/astro@2.5.6/node_modules/astro/dist/core/build/static-build.js:190:10)
    at async Module.viteBuild (file://file:///home/projects/github-kwocty/node_modules/.pnpm/astro@2.5.6/node_modules/astro/dist/core/build/static-build.js:75:21)
    at async AstroBuilder.build (file://file:///home/projects/github-kwocty/node_modules/.pnpm/astro@2.5.6/node_modules/astro/dist/core/build/index.js:140:27)
    at async AstroBuilder.run (file://file:///home/projects/github-kwocty/node_modules/.pnpm/astro@2.5.6/node_modules/astro/dist/core/build/index.js:173:7)
    at async build (file://file:///home/projects/github-kwocty/node_modules/.pnpm/astro@2.5.6/node_modules/astro/dist/core/build/index.js:54:3)
    at async runCommand (file://file:///home/projects/github-kwocty/node_modules/.pnpm/astro@2.5.6/node_modules/astro/dist/cli/index.js:184:14)
    at async cli (file://file:///home/projects/github-kwocty/node_modules/.pnpm/astro@2.5.6/node_modules/astro/dist/cli/index.js:226:5)
 ELIFECYCLE  Command failed with exit code 1.

A few notes:

  • v2.5.5 works fine.
  • All versions >=2.5.6 fail even the latest one.
  • Running the dev server with astro dev works fine.
  • The project where I encountered this issue is a pnpm monorepo.
  • I tried to reproduce the issue in a fresh project (which is not a monorepo) created with pnpm create astro --template starlight but I was not able to reproduce it.

I did not have yet the time to investigate further and git bisect to find the exact commit that introduced the issue but a quick workaround is to use Astro v2.5.5 for now.

I provided a Stackblitz project that reproduces the issue where you can see the error by running cd docs && pnpm build.

The issue is also reproducible in the Starlight repo:

$ git clone https://github.com/withastro/starlight
$ cd starlight
$ pnpm i
$ cd docs
$ pnpm build # this works fine
$ pnpm add astro@latest
$ pnpm build # this fails

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-kwocty?file=docs%2Fpackage.json&view=editor

Participation

  • I am willing to submit a pull request for this issue.
@natemoo-re
Copy link
Member

Based on the changelog, I'm guessing this was introduced in #7193 which updated our build strategy! This probably isn't easy to test automatically which is why we probably missed it.

@natemoo-re natemoo-re added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Jun 15, 2023
@natemoo-re natemoo-re self-assigned this Jun 15, 2023
HiDeoo added a commit to HiDeoo/starlight-typedoc that referenced this issue Jun 16, 2023
natemoo-re added a commit that referenced this issue Jun 16, 2023
* fix(#7397): update astro page entryname logic

* chore: add changeset

* fix: update printed log for injected routes

* fix: ensure /index is included

* test: add custom-404-pkg test

* chore: cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants