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

bundler: Add --ignore-dce-annotations, and other DCE annotation related stuff #12808

Merged
merged 10 commits into from
Aug 1, 2024

Conversation

paperclover
Copy link
Member

@paperclover paperclover commented Jul 25, 2024

What does this PR do?

  • Add --ignore-dce-annotations, one step close to esbuild compatibility
  • Print /* @__PURE */ when not minifying whitespace. This is helpful if the output is consumed by another build tool.
  • Add --emit-dce-annotations to allow emitting annotations even when minifying.

The second and third cases are things I specifically want for future changes to our node_fallbacks code. Right now we use esbuild for that, when we really should use Bun. An issue with using Bun is that DCE comments will get stripped, resulting in no tree shaking when Bun re-bundles them.

Esbuild also has this issue since we are passing --minify to compress the size. In the future, we can pass --minify and --emit-annotations and get both.

src/cli.zig Outdated Show resolved Hide resolved

This comment was marked as outdated.

@paperclover paperclover marked this pull request as draft July 26, 2024 05:49
@paperclover paperclover changed the title bundler: Add --ignore-annotations, and other DCE annotation related stuff bundler: Add --ignore-dce-annotations, and other DCE annotation related stuff Jul 27, 2024
@paperclover paperclover marked this pull request as ready for review July 27, 2024 02:21
Copy link
Collaborator

@Jarred-Sumner Jarred-Sumner left a comment

Choose a reason for hiding this comment

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

tests failing on windows

@robobun
Copy link

robobun commented Jul 29, 2024

@Jarred-Sumner, your commit b6b7766 has 21 failures in #1090

@@ -544,7 +546,7 @@ pub const Options = struct {

module_type: options.OutputFormat = .preserve,

/// Used for cross-module inlining of import items when bundling
// /// Used for cross-module inlining of import items when bundling
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// /// Used for cross-module inlining of import items when bundling
// Used for cross-module inlining of import items when bundling

@Jarred-Sumner Jarred-Sumner merged commit c2cf528 into main Aug 1, 2024
44 of 45 checks passed
@Jarred-Sumner Jarred-Sumner deleted the dave/dce-annotations branch August 1, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants