In my nextjs project, I am utilizing react-bootstrap and bootstrap which requires me to include the global css:
// _app.js
import 'bootstrap/dist/css/bootstrap.min.css';
The issue arises when loading a significant amount of unused css on every page, causing my Google Lighthouse score to decrease.
https://i.sstatic.net/Egtu3.png
Although I have attempted to remove the unused css, there are still lingering styles that are not necessary. Alerts or buttons appear unnecessarily throughout the site, for example.
Is there a method to convert global css into css modules so that only the required styles are imported for each specific page? Perhaps through webpack configuration or another solution?
I could manually split the bootstrap code into components, but I am curious if there is an automated approach available. This way, I wouldn't have to repeat the process for all node_modules requiring styling adjustments.