Skip to content

SSR example misuses React Router v6 #227

@is2ei

Description

@is2ei

Describe the bug

I was trying to use SSR example.
https://github.com/vitejs/vite-plugin-react/tree/v4.1.0/playground/ssr-react

What I expect is that the example works correctly.

What actually happening is that the example misuses React Router v6 as if it is v5.
React Router v6 has breaking changes but the commit 1ea4577 did nothing with that.

For example, it uses context prop on StaticRouter

https://github.com/vitejs/vite-plugin-react/tree/v4.1.0/playground/ssr-react/src/entry-server.jsx#L7

But StaticRouter doesn't have context prop.

https://reactrouter.com/en/main/router-components/static-router

Reproduction

https://github.com/vitejs/vite-plugin-react/tree/v4.1.0/playground/ssr-react

Steps to reproduce

Run npm install followed by npm run dev.

System Info

% npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers
Need to install the following packages:
  envinfo@7.10.0
Ok to proceed? (y)

  System:
    OS: macOS 13.5.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 8.46 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
  Browsers:
    Chrome: 117.0.5938.88
    Safari: 16.6
  npmPackages:
    @vitejs/plugin-react: ^4.1.0 => 4.1.0


### Used Package Manager

npm

### Logs

_No response_

### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite-plugin-react/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite-plugin-react/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite-plugin-react/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite-plugin-react/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions