extract-css-chunks-webpack-plugin icon indicating copy to clipboard operation
extract-css-chunks-webpack-plugin copied to clipboard

Plugin is always preloading and appending to body despite having linkstyles already in HTML

Open KevinGruber opened this issue 4 years ago • 6 comments

Hi,

I am using the newest version of the Plugin + Webpack4.

Since the preload feature was added, it always adds the style tags to the body despite having them already in the HTML. In my opinion it should not add the preload tags if the stylesheets are already added to the HTML.

https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/blob/master/src/index.js#L390

I think it is a bug, as I don't see any reason of adding the same stylesheet twice.

BR, Kevin

KevinGruber avatar Dec 22 '20 18:12 KevinGruber

I have the same problem。This plugin add A stylesheet before B stylesheet in head element but add B stylesheet before A stylesheet in body

I think it is a criticle bug

By the way , I`m using nuxtjs and extractCSS set true

https://n3.map.pg0.cn/T1ZbZLBvZT1RCvBVdK

chinaso2018 avatar Jan 11 '21 08:01 chinaso2018

It seems to cause bugs when use import('./my-module.js'). (./my-module.js includes some .css requires.)

It v4.7.5, js module will be execute after css child dependencies will be fully loaded. But in v4.8, it's seems that css child dependencies and js module will be loaded in parallel.

In parent ./my-module.js module, it has some logic like getComputedStyle(). It fails to get correct style.

v4.7.5 -> v4.8 seems cause a breaking changes.

I will try to create a minimal problem reproduction repo like for you to debug.

kamilic avatar Jan 19 '21 11:01 kamilic

👀 https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/pull/307

t1mwillis avatar Jan 21 '21 02:01 t1mwillis

Same problem here. Stylesheet links get appended both to head and body

TroAlexis avatar Mar 28 '21 18:03 TroAlexis

Same issue. Is author support this plugin yet?

sinneren avatar Apr 26 '22 07:04 sinneren

Fixed in version 4.10.0

rinotova avatar Nov 30 '23 14:11 rinotova