Skip to content

ReactRouterOutletElement.tsx breaks build of Flow application using vaadin-router #19842

Closed

Description

@mcollovati

Description of the bug

If the Flow application is configured to use vaadin-router instead of react-router (e.g. by setting reactEnable=false in vaadin-maven-plugin), the production build fails on Vite execution because react-router-dom import cannot be resolved.

[ERROR] [vite]: Rollup failed to resolve import "react-router-dom" from "/xxxxx/vaadin/starters/skeleton-starter-flow-spring/src/main/frontend/generated/jar-resources/ReactRouterOutletElement.tsx".
[ERROR] This is most likely unintended because it can break your application at runtime.
[ERROR] If you do want to externalize this module explicitly add it to

The workaround is to exclude the flow-react dependency in the POM file.

If it is expected that flow-react should be excluded when using vaadin-router, it should be explicitly documented. In the upgrade guide it looks like an optional step.

Expected behavior

A Flow application using vaadin-router should not fail during build even if flow-react dependency is present.

Minimal reproducible example

Versions

  • Vaadin / Flow version: 24.5-SNAPSHOT
  • Java version: 17

Activity

  1. changed the title [-]ReactRouterOutletElement.tsx breaks Flow application using vaadin-router[/-] [+]ReactRouterOutletElement.tsx breaks build of Flow application using vaadin-router[/+] on Aug 28, 2024
  2. mshabarov commented on Aug 28, 2024

    @mshabarov
    Contributor

    We can keep in mind the documentation upgrade, but better to fix this in the code.

  3. deleted a comment from on Aug 28, 2024
  4. moved this to 🔖 High Priority (P1) in Vaadin Flow bugs & maintenanceon Aug 28, 2024
  5. self-assigned this
    on Aug 28, 2024
  6. added 2 commits that reference this issue on Aug 28, 2024
    8ff6389
    1c0b56b
  7. added a commit that references this issue on Aug 30, 2024
    3dc38a6
  8. moved this from 🔖 High Priority (P1) to ✅ Closed in Vaadin Flow bugs & maintenanceon Aug 30, 2024
  9. vaadin-bot commented on Aug 30, 2024

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 24.5.0.alpha13 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions