Make the package (widget) leaner
Opened this issue · 2 comments
For some time now at work our Next.js 14 front-end codebase has been almost unusable. Initial compilation took more than a minute on my i7 CPU, HMR not working requiring full page refresh, changes taking several seconds to even propagate for page to refresh etc, Next.js server running out of memory crashing etc.
For initial compilation we saw message by Next.js "compiling 30487" modules. After we removed LiFi widget (0 other changes), modules number dropped to ~5100. That's right, 25000 modules less, 600% smaller, initial compilation took only 10 seconds, got back HMR and changes take about 500ms to propagate.
I saw you have dependencies on UI libs so I presume they could be causing it and I think such a simple widget (from UI standpoint) could really be simplifed and shouldn't depend on so much stuff. I'm still amazed that a single widget has 6x more modules than our entire app and libs combined.
@VladimirMikulic thank you for the feedback. Such many modules are only processed in the development mode and they are tree-shaken in the production build. We will take measures to improve DX and shrink them out in the development mode as well.
@chybisov appreciate the response. Yes, I was referring to development mode for all of the issues mentioned above.