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
Pull icons from CDN and remove from bundle #5865
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5865 +/- ##
=======================================
Coverage 66.13% 66.13%
=======================================
Files 1083 1083
Lines 33403 33404 +1
Branches 6298 6298
=======================================
+ Hits 22090 22092 +2
+ Misses 11313 11312 -1
|
@johnnymetz how does https://v4.webpack.js.org/loaders/raw-loader/ work? Presumably that would be a way to return the CDN URL to the list.ts file without writing anything to disk? https://github.com/webpack-contrib/raw-loader/blob/master/src/index.js. Or is the file emit call somehow necessary? It doesn't seem necessary to emit a .txt file of icons. As webpack could just put the strings into the bundle that list.ts goes into If we can't get a loader to work, we can always delete the generated files on CI before zipping up. I want to remove any unused small files though, because small files seem to drastically slow down the Rainforest VMs. (Although we can test with your PR branch and see) |
52a5b94
to
12969b8
Compare
12969b8
to
d79b859
Compare
@twschiller was able to figure out how to do it using the |
When the PR is merged, the first loom link found on this PR will be posted to |
What does this PR do?
simple-icons
andbootstrap-icons
from bundle. This reduced the final bundle size from 19.8 MB to 16.9 MB.Note, we still include the icon file names (e.g.1password.svg
) in the bundle. We need this so users can see / search icons.Discussion
I'm not 100% happy with my implementation. Writing empty files to the final bundle seems hacky. Instead of writing several empty files, I tried creating a webpack loader that creates a file that contains all icon names but couldn't get it to work, see https://stackoverflow.com/questions/76418333/create-webpack-loader-to-write-icon-filenames-to-a-single-fileFederico outlined another approach in Move icon packs to the server #4187 (see "Proposed solution" section) but that seems like overkillDemo
https://www.loom.com/share/461cc4fa7510454391dc170f60135449
Team Coordination
Checklist