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

Publish raw ES Modules without flow typings #11

Open
TheLarkInn opened this issue Jul 27, 2018 · 0 comments
Open

Publish raw ES Modules without flow typings #11

TheLarkInn opened this issue Jul 27, 2018 · 0 comments

Comments

@TheLarkInn
Copy link

TheLarkInn commented Jul 27, 2018

Currently today all of your users (using webpack or other bundlers) are consuming 92kb of transmute. This is because the output target currently for your code (based on your babelrc) is CommonJS.

You can fix this by adding "modules": false for your preset: env options. Here is a link for the full documentation on the preset.

screen shot 2018-07-27 at 3 07 17 pm

screen shot 2018-07-27 at 3 13 14 pm

Attached above are examples of a webpack 4 build attempting to consume this library however pulling much more code then is actually needed. Since JavaScript is the most expensive resource to parse, its vital to only consume what you need. 😍

By doing this, webpack 2+ will be able to treeshake modules more effectively, and as of webpack +4, will be able to Scope Hoist and use our sideEffects: false feature to reduce the cost of using one export to roughly around 1-2kb instead of 92kb.

Here is a stack overflow response from me that explains the features and why: https://stackoverflow.com/questions/49160752/what-does-webpack-4-expect-from-a-package-with-sideeffects-false/49203452#49203452

@aem

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

No branches or pull requests

1 participant