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(bundler): use different alias mappings based on the target. #4163

Merged
merged 3 commits into from
Aug 20, 2023

Conversation

Hanaasagi
Copy link
Collaborator

@Hanaasagi Hanaasagi commented Aug 15, 2023

What does this PR do?

Close: #3844

  1. When bundling the code, use different alias mappings based on the target.
  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

I wrote automated tests.

  • I checked the lifetime of memory allocated to verify it's (1) freed and (2) only freed when it should be
  • I or my editor ran zig fmt on the changed files
  • I included a test for the new code, or an existing test covers it
  • JSValue used outside outside of the stack is either wrapped in a JSC.Strong or is JSValueProtect'ed


pub const Aliases = struct {
// Used by both Bun and Node.
const CommonAliases = bun.ComptimeStringMap(
Copy link
Collaborator

@Jarred-Sumner Jarred-Sumner Aug 17, 2023

Choose a reason for hiding this comment

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

can we make this two separate ComptimeStringMap with all the values for each? That way there's only one hash table lookup for each target, instead of two. The ++ operator should work to combine two comptime-known arrays of tuples

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, fixed.

@Hanaasagi Hanaasagi changed the title Fix(bunder): use different alias mappings based on the target. Fix(bundler): use different alias mappings based on the target. Aug 20, 2023
@Jarred-Sumner
Copy link
Collaborator

Thank you. Sorry I took awhile to merge this

@Jarred-Sumner Jarred-Sumner merged commit 3a9a6c6 into oven-sh:main Aug 20, 2023
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.

Bun overrides "ws" package even when --target=node
2 participants