4 ms·
Would it be possible to split those libraries in smaller modules? For example Preact (https://github.com/developit/preact https://github.com/developit/preact)
by mattecapu 11y ago
Would it be possible to split those libraries in smaller modules?
For example Preact (https://github.com/developit/preact https://github.com/developit/preact) has the same basic API of React but it's just 3kb because a lot of features are stripped away in optional modules.
Also, using preact-compat you could replace it as-is* in your bundle right now.
- andrewingram 11y agoDepends if I need the features in those optional modules. An app is essentially made up from architectural modules (frameworks, alongside anything else that you use everywhere), and then specific pieces of functionality (with dependencies that are used less frequently). If the bulk of your bundle size comes from page-specific functionality, then you can easily benefit from code-splitting and tree-shaking techniques. But those techniques won't help you at all when it's your core architecture that are enormous, because every single page on your site depends on it.