Skip to content

Support virtual:react-router/server-build for usage with React Router 7 #13

@nikolailehbrink

Description

@nikolailehbrink

When using React Router 7, the Vite virtual module virtual:remix/server-build has been renamed to virtual:react-router/server-build.

Currently, @forge42/seo-tools imports virtual:remix/server-build, which causes the Vite build to fail with Rollup resolution errors when used in a RR7 project. Here is an example when I tried to build via Vercel:

[vite]: Rollup failed to resolve import "virtual:remix/server-build" from /vercel/path0/node_modules/.pnpm/@Forge42+seo-tools@1.4.2_typescript@5.8.3/node_modules/@forge42/seo-tools/dist/remix/sitemap.mjs".

To support the React Router 7 architecture, this import path should be updated or made compatible with both versions.

Temporary workaround:
Add the following to vite.config.ts to unblock builds:

build: {
  rollupOptions: {
    external: ['virtual:remix/server-build'],
  }
}

Thanks for maintaining this package — would appreciate support for React Router 7!

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