-
-
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
fix: always externalize ESM and CJS #5903
Conversation
👍 I love this. (As you probably already have guessed :-).) The
To fix the test we can do one of the following:
|
e01ed7a
to
315b1f8
Compare
Though the |
At this moment, not many people have figured out how to publish ESM packages correctly for the Node.js native ESM loader to consume. For example, last I checked, |
Why so? I don't see a reason for supporting code that doesn't and will never exist. If anything he won't do the ecosystem a favor of supporting code that doesn't work with Node.js: code will emerge that only works with Vite which is bad for interoperability. The whole idea of ESM is to have a single standard. Vite will not do anyone a favor of deviating from that standard. |
Yes if the target is the browser. But we are speaking of SSR here. Today, the only target for SSR is Node.js. We shouldn't create a second target being "SSR code that only works with Vite". |
Anyway, I don't think this fix should be a blocker for 2.7.
|
Ok, but note that if we still have other regressions then this PR may actually help. I've been pushing for quite some time for Vite to externalize SSR dependencies. This is an important step in that direction. |
If you test the current regressions and this is fixing them, let's review it. If not, I agree with Sodatea here. Let's try to push 2.7 out and then we can include more fixes when testing 2.8 beta, that we may start right away after the release |
Where can I find the list of regressions? (Couldn't find a proper (combo of) GitHub issue label.) |
(Can't promise anything; I'm super swamped with vite-plugin-ssr and Telefunc and Telefunc's beta release is already way too delayed already.) |
@brillout they are in this milestone https://github.com/vitejs/vite/milestone/4 Direct links to the two issues there: #5706 (you already commented in this one, looks like a PR is actionable) |
@sodatea can you clarify what is wrong with it? We've had lots of complaints about Firebase + SvelteKit and I'd like to send them a PR with a fix if there's something wrong. However, it looks fine to me. It looks like they are using the CJS version for
|
The And that's the case that the original commit intended to avoid (though it used the wrong |
Ah, thanks for clarifying. I think just fixing the |
I strongly believe we should merge this PR. Both #5927 and this PR fix I don't see any reason why we should go for the more complicated solution. As for showing a warning I don't see that to justify complexifying Vite's source code. |
Description
fixes #5890
Additional context
@brillout had suggested this change in #5544 (comment). I wanted to punt on it at the time because it was an extra change I wasn't sure about. However, we've now run into a bug report that would fix and I've had more time to think about the suggestion and become more confident in it.
Some of the lines being removed were introduced in 2.7 via #5197
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).