vuetify-loader icon indicating copy to clipboard operation
vuetify-loader copied to clipboard

[Bug][Vite plugin] Styles are incorrectly treeshaked in some cases when building

Open RylanBueckert-Broadsign opened this issue 1 year ago • 0 comments

Some components styles are not present in when using vite build, but they are available when in dev mode (vite).

Example

If you use v-card-title without v-card in a project, when using dev mode, you can see there is a style applied to .v-card-title that includes font-size, padding, etc. This style is defined in vuetify/lib/components/VCard/VCard.css.

When building for production (vite build + vite preview), this style does not get included in the output and can visually see a difference in the padding of the component.

If a v-card is included in the project anywhere, the style is now loaded and v-card-title has its styles.

I know it may be considered strange or incorrect to use v-card-title without v-card, but I think the main issue here is that the result is not consistent for a build vs the dev mode. In this case I think the behavior should be that the VCard styles should be included if any of the related components are used. Other components may also be affected, but I am not sure.

RylanBueckert-Broadsign avatar Nov 05 '24 16:11 RylanBueckert-Broadsign