-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Virtual modules break esbuild dependency scanning during SSR building #2047
Comments
This only happens because you are using a virtual module as entry. What is the use case for that? |
I'm trying to build something like The reason I am not doing the one-true-entrypoint-approach that then does routing inside it, or uses I think this is kind of a symptom of an architectural issue though, which is that the esbuild dep scanner doesn't know about rollup's modules. If this is the first time this has cropped up then maybe I am just out to lunch, but if vite really wants to support the rollup plugin API, then I imagine virtual modules aren't the only thing that use the |
Thank you sir! |
Describe the bug
When passing custom entrypoints to vite, if the entrypoint doesn't exist on the filesystem directly, the build throws an error when trying to scan the dependencies of the entrypoint when building with
ssr: true
. This can occur when using virtual modules (likevite-react-pages
might), or when using/@fs/
entrypoints to be explicit about absolute paths in the entrypoints. In dev server mode, these entrypoints work fine. I think this would not be common to just modules provided by@rollup-plugin/virtual
, but any module who's contents were provided or changed by a rollup plugin.Reproduction
Here's a reproduction using a branch of the vite playgrounds as an example: main...airhorns:virtual-entrypoint-bug
I believe the issue occurs because the esbuild based dependency scanner doesn't realize that the module is provided by a rollup plugin, and so it looks for it in the filesystem.
Here's a debug log of the build:
System Info
vite
version: 2a6109aDarwin inspector 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
v15.7.0
yarn 1.22.10
Logs (Optional if provided reproduction)
vite
orvite build
with the--debug
flag.The text was updated successfully, but these errors were encountered: