-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
tree shaking and "sideEffects": false ? #843
Comments
Hi @macrozone. Yes, none of the packages actually declare
The only problem is that I think that almost none of the projects would benefit from that. The majority of projects use |
@radekmie the problem that i had is that if my library A re-exports library B, My workaround was to not re-export uniforms-material directly, but to only export the Components that i needed as exports as lazy-load components (using something like @loadable/component i think its worth for the different edge cases. E.g. consider a project using nextjs, where some pages use uniforms and some don't. Maybe in some pages you just import some types (without the special On a side note, i think tree shaking allows libraries to use more complex libraries without declaring them as peer-dependencies (i think peer dependencies are often bad) |
This change introduced a bug as I am getting error
After downgrade to 3.1.0 it work correctly. I am using webpack, babel and babel preset-env to build app. |
i use uniforms on https://github.com/react-page/react-page to generate forms and i wanted to re-export the bundled uniforms version (using something like
export * from 'uniforms-material'
).i noticed that this will bundle everything in, even if you don't use any of the re-exports.
I think this is because uniform packages do not declare
"sideEffects": false
, see https://webpack.js.org/guides/tree-shaking/i think its quite safe to set that, altough there might actually be some sideeffects (i remember that uniforms extended simpl-schema automatically in some versions, that would be a side effect. not sure if its still the case).
The text was updated successfully, but these errors were encountered: