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

Compile Babel helpers to use @babel/runtime modules #66

Closed
wants to merge 1 commit into from

Conversation

lencioni
Copy link

When Babel compiles code, by default it will sometimes inline some
helper functions into each module that needs them. When this happens in
a lot of modules in a lot of packages that are being consumed, it can
add a lot of weight to the JS delivered to consumers.

Babel 7's runtime transform plugin allows packages to compile helpers
out in favor of importing some modules instead, which can be shared
across packages. This reduces the built size of Observable.js from
15800 bytes to 15464 bytes.

I think there's a little more opportunity here to compile to CommonJS
and ESM separately, but I'll leave that for another time.

When Babel compiles code, by default it will sometimes inline some
helper functions into each module that needs them. When this happens in
a lot of modules in a lot of packages that are being consumed, it can
add a lot of weight to the JS delivered to consumers.

Babel 7's runtime transform plugin allows packages to compile helpers
out in favor of importing some modules instead, which can be shared
across packages. This reduces the built size of Observable.js from
15800 bytes to 15464 bytes.
@zenparsing
Copy link
Owner

Thanks for the PR, and for including the built-file sizes.

One of the undocumented goals of this library has always been to be zero-dependency. At present I'm not sure that saving less than 400 bytes is enough to change that, but I'll take it into consideration.

@zenparsing zenparsing closed this Oct 28, 2022
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.

None yet

2 participants