Skip to content

Prerendered pages with an extension in the filename collide with their __route.js under router.resolution: 'server' #16579

Description

@Nic-Polumeyv

router.resolution: 'server' prerenders a <pathname>/__route.js module for each page. When the page's own output filename has an extension, the file and the directory land at the same path and writePrerendered fails.

Repro on version-3, no PR needed:

  1. Add router: { resolution: 'server' } to packages/kit/test/prerendering/basics/vite.config.js
  2. pnpm build && cd packages/kit/test/prerendering/basics && npx vite build
Error: Cannot create directory build/page.html, a file already exists at this position
    at mkdirp (packages/kit/src/utils/filesystem.js:12:11)
    at Object.writePrerendered (packages/kit/src/core/adapt/builder.js:219:8)
[cause]: EEXIST: mkdir 'build/page.html'

That fixture has a src/routes/page.html route, so prerendered/pages/page.html (a file) and prerendered/dependencies/page.html/__route.js (a directory) merge into the same build/ path. save()'s route-conflict guards don't fire because pages and dependencies are separate trees.

Also blocks adding a prerendering fixture with server resolution, which is currently untested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions