Pre bundling of node modules #628
thescientist13
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overview
Currently Greenwood uses
importMap
and walks a user's package.json to map all bare imports to files on disk in node_modules. However, it is very common, especially for libraries to have lots of files and everything broken out into tiny modules.For example, when using lit, you'll see a flood of network requests for JavaScript files in node_modules. 98 requests!
Thoughts
Now, for a few files, this is probably not much of an issue, but it is a lot of network requests, and so all that traffic can cause load times in development to cause the page a bit slower.
Would be interesting to see if there is a way to prebundle all these files ahead of time so only one (or a handful of files) can be loaded instead. That said, if we just aggressively cache these files on disk, then repeated loads would just get served from the browser cache instead, which is tbh, having the browser do all the work sounds great. 😄
Perhaps this could be an option in our configuration?
Beta Was this translation helpful? Give feedback.
All reactions