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
Currently, Snowpack installs every package into a single JS file. As a result, any non-treeshakable code in one package file infects the rest of the package. This means that large packages like fluentui end up not being tree-shakable when you go and build for production.
I can think of two solutions:
Add back our tree-shaking install support, which tree-shakes as a part of installing your web_modules/ dependencies. This was removed since we thought we didn't need it anymore, but it may make sense to add back. This would force us to re-install dependencies on every build, which is a safer move as well but will slow down production builds a bit more than they are now.
Stop using web_modules/ when you build with a bundler. This would give bundlers the highest-fidelity package code to bundle from, but at the expense of complicating how much bundler plugins now need to support. Different bundlers would handle dependencies differently, leading to confusion and complexity.
I'm leaning towards #1 to start, but open to feedback/thoughts.
The text was updated successfully, but these errors were encountered:
As a person who bangs his head against the wall everytime when I have to deal with Webpack I plead for keeping it simple on configuration side. Please :)
If the internal installer uses Rollup, I would think that using Rollup's tree-shaker would be the right choice when doing a build? Then we don't need webpack or other bundlers to do it again.
Edit Also I want to note that tree-shaking should be standardized, it's bad that there are multiple algorithms for it. It's difficult to test if any given package have broken the tree-shaking rules if it's algorithm is not set in stone.
Original Discussion: https://www.pika.dev/npm/snowpack/discuss/274
/cc @Ciantic, @FredKSchott
Currently, Snowpack installs every package into a single JS file. As a result, any non-treeshakable code in one package file infects the rest of the package. This means that large packages like fluentui end up not being tree-shakable when you go and build for production.
I can think of two solutions:
Add back our tree-shaking install support, which tree-shakes as a part of installing your
web_modules/
dependencies. This was removed since we thought we didn't need it anymore, but it may make sense to add back. This would force us to re-install dependencies on every build, which is a safer move as well but will slow down production builds a bit more than they are now.Stop using
web_modules/
when you build with a bundler. This would give bundlers the highest-fidelity package code to bundle from, but at the expense of complicating how much bundler plugins now need to support. Different bundlers would handle dependencies differently, leading to confusion and complexity.I'm leaning towards #1 to start, but open to feedback/thoughts.
The text was updated successfully, but these errors were encountered: