Skip to content

Improve developer experience by changing message "failed to load module for ssr" #10002

@lloydjatkinson

Description

@lloydjatkinson

Description

As an indirect user of Vite by using Astro, I would like the failed to load module for ssr to express why the module failed to load.

I believe there are multiple conditions that can trigger this - the one I experience often is a wrong path to a file. It's only through past experience of this error that I know, in my case at least, that this usually means the file was not found.

Suggested solution

const result =
mod.ssrTransformResult ||
(await transformRequest(url, server, { ssr: true }))
if (!result) {
// TODO more info? is this even necessary?
throw new Error(`failed to load module for ssr: ${url}`)
}

Complete the TODO and display a more informative message stating why the module failed to load.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

Labels

p2-nice-to-haveNot breaking anything but nice to have (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions