简体   繁体   中英

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!

我通过升级到webpack 4并使用mini-css-extract-plugin解决了此问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM