-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Curious behaviour when loading CJS/ESM with vite.ssrLoadModule
#11385
Comments
I just stumbled upon this comment #8484 (comment) that seems to be the curious behaviour I encountered. |
It seems the fix is in this PR comment #10504 (review) Sorry for tagging people, I'm just trying to connect all the dots and have the information in one place. |
i'm also having issues with in my service layer js
Log from the Terminal
|
https://publint.bjornlu.com/uuid@9.0.0 |
I think publint is wrong on this one as Vite SSR shouldn't be using the This is an unintentional change from here as I'll make a PR to remove this condition. I don't think it'll break packages in practice as
That's currently a bug that I tried to fix during Vite 4 beta but reverted as the ecosystem seem to had relied on the old behaviour. There's more info at #11114 |
@patak-dev @bluwy Thank you for fixing this so fast. Is there a timeline for when this fix will be released? As this bug broke probably a bunch of applications (including mine 😄) it would be great to have this fix available soon. |
@nhe23 released in vite@4.0.3, sorry for the regression 👍🏼 |
@patak-dev That was fast 😄. Thank you for your work 👍 |
Thanks @patak-dev and @bluwy for the very speedy fix 🤝 |
Describe the bug
After upgrading to Vite 4 I am no longer able to consume certain packages, but the same packages worked in Vite 3:
uuid
(same issue reported in Importing from uuid no longer works when upgrading from vite 3.2.4 to 4.0.1 #11378)@vanilla-extract/css/adapter
(uses Preconstruct to generate thepackage.json
)See linked repo for instructions and reproduction.
But investigating a bit further why it fails with
@vanilla-extract/css/adapter
I've identified a curious behaviour.I've recorded a CodeTour in the linked repo which explains the behaviour (requires VS Code).
TL;DR:
@vanilla-extract/css/adapter
main entry point (defined inpackage.json#exports
) using themodule
condition (./dist/vanilla-extract-css-adapter.esm.mjs
), then reverts topackage.json#main
(./dist/vanilla-extract-css-adapter.cjs.js
).@vanilla-extract/css/adapter
is resolved to./dist/vanilla-extract-css-adapter.cjs.js
using thedefault
condition.Reproduction
https://github.com/mrm007/vite-mjs-repro
Steps to reproduce
pnpm install
pnpm vite4
Instructions are also in the linked repo's README.
System Info
Used Package Manager
pnpm
Logs
With
uuid
:With
@vanilla-extract/css
:Logs are also in the linked repo's README.
Validations
The text was updated successfully, but these errors were encountered: