You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Projects using webpack that consume this library cannot tree-shake it, it will always import the whole library even if I import only the Button.
Expected behaviour
Only the Button component should be imported.
Steps to reproduce
Add the package in a project, import a Button component
Use Webpack to build (in production mode)
Analyse the built files (the whole package are imported)
Context (version, environment, browser)
Node 12.13.0
Webpack 4.41.2
Typescript 3.7.2
Screenshots (optional)
Additional details (optional)
Webpack can only do tree-shaking on npm packages that are built in a way compatible for tree-shaking (https://webpack.js.org/guides/tree-shaking/#conclusion).
In short, no bundling, keep native import/export, and define sideEffects
In perspective, at Equisoft/analyze, we have different apps working in different scenarios, like some are loaded within the client website or integrated in a already huge apps, so each byte do matter for us. Same as this library, we also like having our npm packages fat too (one package that contains lot of things instead of multiple micro separated packages). For that matter, we make all our npm tree-shakable. Our setup is to use only tsc to compile each file individually instead of webpack.
The text was updated successfully, but these errors were encountered:
Current behaviour
Projects using webpack that consume this library cannot tree-shake it, it will always import the whole library even if I import only the Button.
Expected behaviour
Only the Button component should be imported.
Steps to reproduce
Context (version, environment, browser)
Node 12.13.0
Webpack 4.41.2
Typescript 3.7.2
Screenshots (optional)
Additional details (optional)
Webpack can only do tree-shaking on npm packages that are built in a way compatible for tree-shaking (https://webpack.js.org/guides/tree-shaking/#conclusion).
In short, no bundling, keep native import/export, and define sideEffects
In perspective, at Equisoft/analyze, we have different apps working in different scenarios, like some are loaded within the client website or integrated in a already huge apps, so each byte do matter for us. Same as this library, we also like having our npm packages fat too (one package that contains lot of things instead of multiple micro separated packages). For that matter, we make all our npm tree-shakable. Our setup is to use only
tsc
to compile each file individually instead of webpack.The text was updated successfully, but these errors were encountered: