Skip to content
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: disable code splitting for optimized dependencies #14249

Closed

Conversation

Methuselah96
Copy link

@Methuselah96 Methuselah96 commented Aug 31, 2023

Description

Disables code splitting for optimized dependencies.
Fixes #12423.
Fixes #5142.

Additional context

The esbuild docs say that "code splitting is still a work in progress...with a known ordering issue" and is not "ready for use in production yet". The ordering issue has been around for several years with no end in sight.

It seems problematic to rely on a feature from esbuild that is known to have issues and therefore causes issues for the users of Vite.

See #12423 (comment) for more context.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Aug 31, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@Methuselah96 Methuselah96 changed the title Disable code splitting Disable code splitting for optimized dependencies Aug 31, 2023
@Methuselah96 Methuselah96 changed the title Disable code splitting for optimized dependencies fix: disable code splitting for optimized dependencies Aug 31, 2023
@ArnaudBarre
Copy link
Member

This would probably means that multiple version of the same lib get served, which is a no go for React.

@Methuselah96
Copy link
Author

I created this more out of annoyance that Vite is repackaging a non-stable feature of esbuild and calling it stable. It's not a very constructive way for me to vent, I'm just a little frustrated to see Vite doing this and putting users in that situation. Since this is unlikely to go anywhere, I'll go ahead and close it. The ship has already left the harbour and there's no turning back now.

@Methuselah96 Methuselah96 deleted the disable-code-splitting branch September 3, 2023 19:39
@ArnaudBarre
Copy link
Member

Vite will not be where it is without esbuild & esbuild pre-bundling. No body for now has a stable fast bundler available.
And this issue is one the reason esbuild is not used for builds. If you have a something better than esbuild, we will be please to use it. Otherwise you can use webpack of anything else probably less stable than Vite.

@Methuselah96
Copy link
Author

Methuselah96 commented Sep 3, 2023

If it's not stable, then imo there should be a big disclaimer on the front page that says so, so that people who want stability don't have to waste their time. esbuild is stable, it's just the code splitting feature that is not stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants