Skip to content

Error “Failed to find” for css files in the node_modules in a hoisted setup #22020

@platosha

Description

@platosha

Description of the bug

The issue concerns multi-module repositories using npm monorepo and hoisted dependencies installation. Consider the directory structure:

  • package.json — main file
  • node_modules/ — common npm dependencies
  • packages/ts/my-component/ — frontend component using Vaadin web component dependencies
  • packages/java/vaadin-app/ — the Vaadin application
    • packages/java/vaadin-app/package.json — Vaadin app dependencies
    • packages/java/vaadin-app/node_modules/ — app specific npm dependencies

In a setup like that, Vaadin web component dependencies get “hoisted”, e. g., installed in the common upper node_modules directory for ultimately being shared between my-component and vaadin-app. So even though a package is listed in packages/java/vaadin-app/package.json, it could be actually installed to node_modules/

The Hilla repository is using a setup like that. Some IT projects in the Hilla repository fail with the following error:

Error:  The build process encountered an error: Could not execute build-frontend goal Error occured during goal execution: 

  Failed to find the following css files in the `node_modules` or `.../hilla/packages/java/tests/spring/react-i18n/src/main/frontend` directory tree:
      - @vaadin/vaadin-lumo-styles/lumo.css

The @vaadin/vaadin-lumo-styles package is installed in the common node_modules/, whereas Flow is expecting it to be in the app-specific directory.

Expected behavior

Flow using Node resolution rules when locating frontend packages and is able to use hoisted installation. This would be aligned with Vite and other Node-based tools.

Minimal reproducible example

See PR build: https://github.com/vaadin/hilla/actions/runs/16906563241/job/47897784956?pr=3871#step:7:1809

Versions

  • Vaadin / Flow version: 25.0-SNAPSHOT
  • Java version:
  • OS version:
  • Browser version (if applicable):
  • Application Server (if applicable):
  • IDE (if applicable):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions