reactjswebpackwebpack-3react-loadablereact-universal

React Loadable requesting new css in dynamically loaded components


I'm using react loadable to code split off components. I'm also using Extract CSS Chunks to split my stylesheets up. Everything works great during server side rendering and the initial client side render, but when I transition to a new page and a component is dynamically imported, the JS is being fetched, but the corresponding CSS for the component is not.

This wasn't an issue when all my CSS was in one file, but now that it's not, how am I to fetch the CSS along with the JS for dynamically imported components? Is that what Webpack Flush Chunks is supposed to help with?

Thanks in advance!


Solution

  • I solved this issue by upgrading to webpack 4 and using the mini-css-extract-plugin