Skip to content

Problems when building with vite 6.x.x #137

@steinarb

Description

@steinarb

Starting with vite 6.0.0 my applications using redux-first-history 5.2.0 get the following stack trace on startup:

chunk-K6AXKMTT.mjs:182 Uncaught Error: useRoutes() may be used only in the context of a <Router> component.
    at invariant (chunk-K6AXKMTT.mjs:182:11)
    at useRoutesImpl (chunk-K6AXKMTT.mjs:4200:3)
    at useRoutes (chunk-K6AXKMTT.mjs:4197:10)
    at Routes (chunk-K6AXKMTT.mjs:5045:10)
    at renderWithHooks (react-dom-client.production.js:3681:21)
    at updateFunctionComponent (react-dom-client.production.js:5637:15)
    at beginWork (react-dom-client.production.js:6666:14)
    at performUnitOfWork (react-dom-client.production.js:10860:14)
    at workLoopSync (react-dom-client.production.js:10743:37)
    at renderRootSync (react-dom-client.production.js:10724:20)

When building with the last v5 vite (5.4.14 at the time of writing), the application starts up normally.

Googling the error message gives me matches like this https://stackoverflow.com/a/69796015 (that the router is missing)
So maybe (just a guess), with vite 6.x.x HistoryRouter is no longer recognized as a router...?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions