FortAwesome / Font-Awesome

The iconic SVG, font, and CSS toolkit
https://fontawesome.com
Other
73.67k stars 12.19k forks source link

Bug: Minified bundle contains unminified CSS #19365

Open muuvmuuv opened 2 years ago

muuvmuuv commented 2 years ago

Bug description

Just discovered while serving everything fa related in a different Vite bundle, that fa contains unminified CSS. I guess its coming from SVG-Core and https://github.com/FortAwesome/Font-Awesome/blob/d3a7818c253fcbafff9ebd1d4abb2866c192e1d7/js-packages/%40fortawesome/fontawesome-svg-core/styles.css.

Reproducible test case

https://replit.com/@muuvmuuv/Vite-Font-Awesome#dist/assets/index.0ba6325b.js

Screenshots

Bildschirmfoto 2022-10-06 um 15 13 14

Font Awesome version

^6

Serving

Self-hosted

Implementation

SVG+JS

Browser and Operating System

All

Web bug report checklist

sander-lameco commented 1 year ago

Came here with the same issue. Anyone know any fix? We use ViteJS with esbuild which should minify by default.

I believe it is coming from this piece of code: https://github.com/FortAwesome/Font-Awesome/blob/6.x/js-packages/%40fortawesome/fontawesome-svg-core/index.js#L615

tagliala commented 1 year ago

Can you try to opt out from automatic css and import it normally?

https://fontawesome.com/v6/docs/apis/javascript/configuration#contentHeader

autoAddCss

sander-lameco commented 1 year ago

Hi @tagliala thanks for the tip but sadly that didn't exclude the CSS from the compiled JS.

tagliala commented 1 year ago

@mlwilkerson any chance to take a look here?