Vaadin14: @HtmlImport ignored?


my main view is something like:

@Route(value = "")
@Theme(value = Lumo.class)
public class AViewHost extends Div implements ErrorHandler, PageConfigurator {

while style.html contains:

        body { /* FIXME */
            background-color: red !important;

style.css is loaded and parsed properly.

style.html is loaded properly if you point the browser to localhost:8081/frontend/html/style.html, but Vaadin14 seems to ignore it.

Any help? I tried to read but had no luck.


If you’re using not using Compatibility mode (aka Bower mode), @HtmlImports are ignored; you should use @JsModule and JavaScript modules instead. Read more here:

Olli, thank you so much for pointing me to the right direction.

Is there any reason for JS modules to be put in a frontend/ directory under the project’s root instead of src/main/webapp/frontend/? This looks quite inconsistent.

Thanks again,

src/main/webapp/frontend/ is a web folder.
frontend/ is not available anyhow in the resulting web application as resources.

Everything is bundled using webpack into one file. So no any single js module is loaded from anywhere.

Thanks Denis, I can see the point in what you say.
(Still, I would have used src/main/frontend/, as js modules are source code too… :slight_smile:

Thank you so much,

Olli and Denis, thanks again: your posts helped me to reach the goal.