jantimon/html-webpack-plugin

Some CSS styles not being applied correctly after webpack build

clickwithclark opened this issue ยท 2 comments

Current behaviour ๐Ÿ’ฃ

Some CSS styles may not be applying properly

Expected behaviour โ˜€๏ธ

All CSS styles to work properly at all times

Reproduction Example ๐Ÿ‘พ

I am very new to webpack but I have noticed that some of my CSS was not being applied unless I specifically set the minify property to false. It took me many hours to determine this and I am not yet certain if it was my improper use of the CSS loaders or not but I would still like to report it here for other users to be able to have a fix on demand.

Environment ๐Ÿ–ฅ

Node.js v14.15.5
win32 10.0.19043
npm 7.24.1
โ”œโ”€โ”ฌ clean-webpack-plugin@4.0.0
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ css-loader@6.3.0
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ css-minimizer-webpack-plugin@3.0.2
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ html-loader@2.1.2
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ html-webpack-plugin@5.3.2
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ mini-css-extract-plugin@2.3.0
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ sass-loader@12.1.0
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ style-loader@3.3.0
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ url-loader@4.1.1  #not being used i am using the 'asset/resource' method instead
โ”‚ โ”œโ”€โ”ฌ file-loader@6.2.0 #not being used i am using the 'asset/resource' method instead
โ”‚ โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ webpack-cli@4.8.0
โ”‚ โ”œโ”€โ”ฌ @webpack-cli/configtest@1.0.4
โ”‚ โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ webpack-dev-middleware@5.2.1
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ webpack-dev-server@4.3.0
โ”‚ โ””โ”€โ”€ webpack@5.56.0 deduped
โ”œโ”€โ”ฌ webpack@5.56.0
โ”‚ โ””โ”€โ”ฌ terser-webpack-plugin@5.2.4
โ”‚   โ””โ”€โ”€ webpack@5.56.0 deduped
โ””โ”€โ”ฌ workbox-webpack-plugin@6.3.0
  โ””โ”€โ”€ webpack@5.56.0 deduped

html-webpack-plugin@5.3.2
  plugins: [
    new HtmlWebpackPlugin({
      filename: './index.html',
      template: './template.html',
      minify: false, //<- for styles to work
    }),

Minify:true /or unset

Here you see most styles loading but for some reason, not the styles concerned with the input field.

true

Minify:false

Here all the styles are being applied correctly
false

If I can reproduce this bug better I will update but for now I am hoping the title at lease can help someone else, It took me forever!

Thanks for opening this issue - it's hard to tell anything without a reproduction..
Minification is done by html-minifier-terser

stale commented

This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.