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(dev): update esbuild, tree shake CSS bundle #7374

Closed
wants to merge 7 commits into from

Conversation

markdalgleish
Copy link
Member

@markdalgleish markdalgleish commented Sep 8, 2023

Since esbuild v0.17.7+ no longer tree shakes CSS and this means we're stuck on esbuild v0.17.6, this PR is an experiment to see if we can manually tree shake CSS by performing two esbuild passes during the CSS bundle build. The first esbuild pass is effectively the same as before, except now we keep all generated CSS files in memory. We then check which files were referenced in the JS output and use this as input to a 2nd esbuild pass containing only referenced CSS files.

This PR is currently against the release-next branch so that it's up to date with the latest compiler code, but if it lands it's likely to go in dev.

@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2023

⚠️ No Changeset found

Latest commit: 008f370

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets
Name Type
create-remix Patch
remix Patch
@remix-run/architect Patch
@remix-run/cloudflare Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
@remix-run/css-bundle Patch
@remix-run/deno Patch
@remix-run/dev Patch
@remix-run/eslint-config Patch
@remix-run/express Patch
@remix-run/node Patch
@remix-run/react Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch
@remix-run/testing Patch

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@pcattori pcattori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let's wait to merge this until after v2

@MichaelDeBoey MichaelDeBoey deleted the branch release-next September 15, 2023 19:30
@MichaelDeBoey MichaelDeBoey deleted the markdalgleish/css-tree-shaking branch October 28, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants