Skip to content

Could not load tsr:routes-manifest (property imports is undefined on ViteManifest #3988

Closed
@nea89o

Description

@nea89o

Which project does this relate to?

Start

Describe the bug

During pnpm build (which is vinxi build) the following error is produced:

[2:26:37 PM]  ERROR  [tsr-routes-manifest] Could not load tsr:routes-manifest (imported by node_modules/.pnpm/@tanstack+solid-start-router-manifest@1.115.3_db0@0.3.1_ioredis@5.6.1_jiti@2.4.2_terser@5.39.0_tsx@4.19.3/node_modules/@tanstack/solid-start-router-manifest/dist/esm/index.js): could not read imports of {"file":"assets/client-CbsYcdXg.js","name":"client","src":"virtual:$vinxi/handler/client","isEntry":true,"dynamicImports":["app/routes/index.tsx?tsr-split=component"]}

The error here is slightly modified due to an inserted try catch by me:

                if (entryFile) {
			      try {
                    routes.__root__.preloads = [
                        path.join(opts.clientBase, entryFile.file),
                        ...entryFile.imports.map((d) => path.join(opts.clientBase, manifest[d].file)),
                    ];
			      }catch (e) {
			         throw new Error("could not read imports of " + JSON.stringify(entryFile), {cause: e})
			      }
                }

The issue here is that .imports is being read and expected to be an array, but it is undefined.

Vite declares the manifest chunk with an optional imports array (https://github.com/vitejs/vite/blob/be2c3fa5c50c9258ecd905a211f7f1e3558cd77f/packages/vite/src/node/plugins/manifest.ts#L17-L27) while tanstack-solid-config declares the manifest chunk with a non optional imports array (

type ViteManifest = Record<
string,
{
file: string
isEntry: boolean
imports: Array<string>
}
>
)

Your Example Website or App

https://github.com/nea89o/tsuchi/tree/48bbcf294c25f5e4e468ac034fcea73327e7f35d

Steps to Reproduce the Bug or Issue

  1. pnpm build

Expected behavior

i dont expect a crash, or at least a crash with a nicer error message than "Could not load tsr:routes-manifest; Could not read property map of undefined"

Screenshots or Videos

No response

Platform

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions