Skip to content

Conversation

@pawelblaszczyk5
Copy link
Contributor

Fixes #170

Description

Currently, in code the flag that's being checked is unstable_viteEnvironmentApi, however in one of recent RR updates it got promoted to v8_viteEnvironmentApi. This made it mandatory to rename the field in config when upgrading version, which caused the plugin to not work properly. This PR fixes this, while still providing compatibility with the previous version.

Type of change

Please mark relevant options with an x in the brackets.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Algorithm update - updates algorithm documentation/questions/answers etc.
  • Other (please describe):

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
list any relevant details for your test configuration

  • Integration tests
  • Unit tests
  • Manual tests
  • No tests required

I patched the version locally to make sure that's what causing issues with deploy and then decided to upstream the fix 😄

Reviewer checklist

Mark everything that needs to be checked before merging the PR.

  • Check if the UI is working as expected and is satisfactory
  • Check if the code is well documented
  • Check if the behavior is what is expected
  • Check if the code is well tested
  • Check if the code is readable and well formatted
  • Additional checks (document below if any)

Screenshots (if appropriate):

Questions (if appropriate):


const isEnvironmentApiEnabled =
pluginConfig.future.unstable_viteEnvironmentApi ??
(pluginConfig.future as { v8_viteEnvironmentApi?: boolean }).v8_viteEnvironmentApi;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure whether you'd prefer casting or ts-expect-error here. Currently in dependencies there's a version before this being promoted to v8. However, one of this will always error. I guess the back-compat could be removed shortly in the future, as environment API support was marked as experimental?

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 12, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/rphlmr/react-router-hono-server@171

commit: 4cda406

@rphlmr
Copy link
Owner

rphlmr commented Jan 12, 2026

👋 thanks! I’ve launched the CI so you can test the preview package.
I will take a deeper look but I’m ok to have a breaking change that requires at minimum a given React Router version

@pawelblaszczyk5
Copy link
Contributor Author

Thanks a lot! If you prefer I can update this to use only the new flag name. I thought that the compatibility isn't too much hassle and doesn't complicate too much so it may be worth. So up to you - lmk when you have a moment to take a look

Copy link
Owner

@rphlmr rphlmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rphlmr rphlmr merged commit 1defe62 into rphlmr:main Jan 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatibility with v8_viteEnvironmentApi

2 participants