vite icon indicating copy to clipboard operation
vite copied to clipboard

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

Open lloydjatkinson opened this issue 1 year ago • 1 comments

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

https://github.com/vitejs/vite/blob/3a586e4818ed0bd1d6974dc6718fe5ea44b72bd7/packages/vite/src/node/ssr/ssrModuleLoader.ts#L87-L93

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

Alternative

No response

Additional context

No response

Validations

lloydjatkinson avatar Sep 06 '22 02:09 lloydjatkinson

Hi, can you provide a repro to test this one out? I tried to bring this edgecase out in the past but couldn't get it to reach the error.

bluwy avatar Sep 06 '22 16:09 bluwy

Repro: https://stackblitz.com/edit/github-ad1c93?file=test.js

bluwy avatar Oct 24 '22 09:10 bluwy