Importing styled-octicons causes massive bloat during development with next dev
Unanswered
Holland Lop posted this in #help-forum
Holland LopOP
When importing icons from styled-octicons my Next server grinds to a halt (14.0.4), with the build bloating from a few megabytes to 400 MB. Are there any options I can set to fix this in Next? Description here: https://github.com/primer/octicons/issues/981
9 Replies
Holland LopOP
Usage:
import { CommentIcon } from '@primer/styled-octicons';@Holland Lop Usage:
import { CommentIcon } from '@primer/styled-octicons';
try adding it to the transpiled packages
Holland LopOP
Added the following to my next config and rebooted server, same result:
transpilePackages: [
'@primer/octicons-react',
'@primer/styled-octicons'
],Also takes multiple minutes to boot server
Holland LopOP
Thanks, that did speed it up a lot - went to 40 MB loaded now + build is much faster
One submitted PR to the icon repo seems to maybe fix the underlying issue, added a comment there
@Ray https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports
try this
thanks thats what i meant. so tired
Holland LopOP
Thank you guys ðŸ™