extract-text-webpack-plugin doesn't load css in dynamically loaded chunks

321 Views Asked by At

I'm working on a multi-entry web app & building with webpack 3, with using extract-text-webpack-plugin to separate entries' css in separate files.

Currently, I'm trying to load some modules dynamically along with their own css to enhance performance, so I used the plugin's allChunks: false option with using the style-loader as a fallback, which works fine when the css file is being required in dynamic modules only, or non-dynamic entry-points only,

I've made a sample project to demonstrate this issue, so let's assume the following entries:

  • entry2: dynamic.css should be part of the extracted css entry2.css --> which works fine
  • entry1: dynamic.css should be part of the dynamically imported chunk dynamic.js, where the contents of dynamic.css will be injected in page with style-loader --> This doesn't work, instead dynamic.css is totally gone

I've already opened an issue on plugin's github repo, but it seems that they are focusing on webpack 4 more than webpack 3, so I'm not expecting they would respond to my issue!

Question is

Is there a workaround to load this shared css dynamically (overcoming this reported issue)?

0

There are 0 best solutions below