vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
590 stars 163 forks source link

@CssImport include parameter does not work in add-on project in Vaadin 23 #13563

Open TatuLund opened 2 years ago

TatuLund commented 2 years ago

Description of the bug

My badge add-on is importing Lumo badge styles using include parameter

https://github.com/TatuLund/badge/blob/master/src/main/java/org/vaadin/addons/badge/Badge.java#L19

This works ok with Vaadin 14, but no longer works with Vaadin 23.

I inspected the frontend bundle and saw the css imported by @JsModule was there, but for some reason styles are not applied. There is no server or console errors.

When I refactored the add-on to be web component and import the styles in web component instead, they work

See https://github.com/TatuLund/badge/blob/v23/src/main/resources/META-INF/resources/frontend/badge.ts#L2

This proves that problem is not in @JsModule, but @CssImport

Note, include parameter works ok when using in the main app, as is seen e.g. here: https://cookbook.vaadin.com/grid-pro-conditional-edit

Expected behavior

@CssImport with include parameter to work in add-on / jar modules

Minimal reproducible example

Badge add-on V14 version of the code.

Versions

TatuLund commented 10 months ago

Is this linked to https://github.com/vaadin/flow/issues/16979