-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Why put block level requires to global scope? #1352
Comments
Doing what you proposed (injecting a separate copy of the helper function library into every single function that uses them) would be very undesirable. It would likely cause a huge increase in code size and would make the generated code run slower as the JIT would process each copy of every helper function separately. I can think of two ways of doing what you want:
|
Code size and performance is not an issue for me. I want this just for a single function but fine if it get injected to every. So, I assume currently there is no option built in for this? |
No there isn't one option for this but the banner and footer options make doing this trivial. |
So,
I have a function like this,
After bundling, the whole thing transforms into this,
This is problematic because I serialize the function foo() at runtime and put it inside a web worker and when it runs at web worker, require_some_lib and it's dependencies like __commonJS , __require are undefined.
Is there an option to get the bundle output something like this?
The text was updated successfully, but these errors were encountered: