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: allow a way to define what global variables are allowed #9382

Open
paperdave opened this issue Mar 12, 2024 · 2 comments
Open

bundler: allow a way to define what global variables are allowed #9382

paperdave opened this issue Mar 12, 2024 · 2 comments
Labels
bundler Something to do with the bundler enhancement New feature or request

Comments

@paperdave
Copy link
Collaborator

paperdave commented Mar 12, 2024

What is the problem this feature would solve?

This bug went unnoticed in bug for ?????? amount of time.

image

This should be a compile error at least in the context of bun's own codebase. but secondly we should have had tests that hit this branch of code, as we currently don't, and my only reproduction into it is via some form of flakiness of native readable on Windows.

What is the feature you are proposing to solve the problem?

allow an opt-in explicitly defining a list of globals or having a builtin default of the globals the target likely has. a bundle error occurs when a unbound global is used.

What alternatives have you considered?

  • it would be a bad idea to further increase complexity of the builtin bundler. ideally as time goes on we move more features of it into general purpose features of the bundler.

  • another idea is to simply use a JS linter, or fully migrate all the builtin code into typescript, but these have many shortcomings.

@paperdave paperdave added enhancement New feature or request bundler Something to do with the bundler labels Mar 12, 2024
@Jarred-Sumner
Copy link
Collaborator

IMO, the real fix here is using TypeScript.

@paperdave
Copy link
Collaborator Author

there are 37858 remaining lines of javascript within src/js, as well as the fact we do not use tsc to check any of our code, as well as the fact tsc currently crashes in our repository. but this is likely still a better solution, but a longer term one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bundler Something to do with the bundler enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants