-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Vite seems to be bundling dependencies it shouldn't? #11785
Comments
The person from vite already did a brief analysis, which I advise you to follow. You have some development dependencies inside Also, your |
Hey @ematipico, I appreciate the prompt response – to answer your first question, I believe it is expected? Otherwise I'd have to have deep path imports for every method I'd like to call, so I use an I'm unfortunately in a bit of a tight spot, because the dependencies that were mentioned in the other thread – ones that are using dev dependencies like Prettier and TypeScript – I'm using to format and modify TypeScript ASTs on the server (prerendered JSON routes). So I would think they should be regular dependencies, unless they're dev in the sense that they're only required to prerender server routes during build-time? |
So I did a bit more digging here and it looks like the error is because Vite is bundling I sort of understand why this is happening, seeing Apart from adding |
Your repro no longer exists. Are you still having this problem? |
Hello @Nickersoft. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I apologize in advance that I don't have a minimal reproduction of this, as I'm not sure what is actually causing the behavior to begin with (I do have a repro though).
I'm currently trying to build my Astro project inside a PNPM monorepo and am referencing a shared private monorepo package.
I'm only using the methods from it to prerender a few pages and JSON routes, however, Astro/Vite seems to be trying to bundle all of the code into
dist/server/chunks
, including some CJS dependencies that rely on__filename
and result in the following error when building:I don't have a firm grasp on how Astro actually prerenders routes, so I'm not sure what I can change to try to fix this. I originally opened an issue with the Vite team but they redirected me back here seeing Astro has a lot of moving parts and maybe the way the compiler works is causing this.
To reproduce, you just run
pnpm install
in my linked repo then runpnpm build
from inside thewww
directory.What's the expected result?
Expected to be able to use a local monorepo package and have it prerender routes without issue (or at lest transform the CJS).
Link to Minimal Reproducible Example
https://github.com/Nickersoft/code-snippets/tree/nickersoft/build-bug/www
Participation
The text was updated successfully, but these errors were encountered: