Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Partially addresses #3024. This allows you to use CJS dependencies on the client-side. The server-side is still broken. I haven't looked into the cause for that yet, but that will probably involve larger changes since SSR is further away from being stable
Additional context
Most dependencies aren't pre-bundled today, which causes lots of issues. This is the top cause of user difficulties in SvelteKit today. Basically the only way you can use SvelteKit is by manually converting all your transitive dependencies to ESM. That can be quite hard to do when you depend on numerous npm modules. I've been trying to convert svelte.dev to SvelteKit and haven't been able to yet. I've hit four or five issues with dependencies and am still working through them and am not sure I can get the necessary changes into some of the libraries we use.
I don't understand if there's a reason the code was written the way it was initially. I didn't see any obvious reason for the current logic while doing a git blame. The docs say:
Vite today does not adhere to what was written in the docs because a large fraction of code is not served as native ESM without a change like the one in this PR
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).