Consider bundling Snowpack #1950
Rich-Harris
started this conversation in
Ideas
Replies: 3 comments 4 replies
-
Yes! Strong +1, I've wanted to do this for a while but have been waiting for a breaking change, will happen in v3 |
Beta Was this translation helpful? Give feedback.
0 replies
-
A thing of beauty: |
Beta Was this translation helpful? Give feedback.
1 reply
-
That was short lived. (v. 3.0.7) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Snowpack has a very large number of dependencies — significantly larger than, say, webpack, which is often used as an example of a package with an unwieldy dependency graph:
This is reflected in the time it takes to
npm install snowpack
or for Snowpack to start up. Installing Snowpack into a fresh project results in 44MB of node_modules.A useful point of comparison is wmr, which is roughly similarly scoped but yields 2.8MB of node_modules:
wmr doesn't achieve this outcome by not having dependencies, it achieves it by bundling them. Snowpack could do the same. I rustled up a proof of concept here, and the results speak for themselves:
Installation/startup times are obviously approximate as there's some variance, but the bundled version is reliably significantly faster.
This proof of concept uses esbuild with only very minor changes to the source code. For even better startup time results, it would make sense to use code-splitting and dynamically import modules (for example only loading the
build
command if the user ransnowpack build
) — this isn't currently possible with esbuild (which can only do code-splitting for ESM builds) but would be trivial with Rollup.Beta Was this translation helpful? Give feedback.
All reactions