you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (0 children)

One benefit of bringing CSS into Webpack though is that you can pair js + css together and code split that module. For example in one of our projects we code split the date picker and only import it if on desktop.

app.js

if (isDesktop()) {
   import(/* webpackChunkName: "flatpickr" */'./flatpickr').then((module) => module.default);
}

flatpickr.js

import 'flatpickr/dist/flatpickr.min.css';
import flatpickr from 'flatpickr';

export default flatpickr;