Repository: getsentry/sentry-javascript (TypeScript)

Issue:
[RR7] url in unstable_sentryVitePluginOptions is ignored in React Router Vite plugin
### Is there an existing issue for this?

- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

### How do you use Sentry?

Self-hosted/on-premise

### Which SDK are you using?

@sentry/react-router

### SDK Version

9.10.1

### Framework Version

react-router@7.4.0 + vite@6.2.4 + @sentry/react-router@9.10.1" 

### Link to Sentry event

_No response_

### Reproduction Example/SDK Setup

We have a self hosted Sentry setup and last week we migrated from @sentry/remix to @sentry/react-router. Before we could set the `url` in the Vite Sentry plugin options to point to our self hosted Sentry instance. With the new React Router plugin this value seems to be ignored.

The only way to upload the source maps to our Sentry instance is by setting the env var SENTRY_URL. 

Setting the url in the plugin configuration does not seem to do anything, Sentry uses the default value:

```javascript
const sentryConfig: SentryReactRouterBuildOptions = {
  org: 'sentry',
  project: env.VITE_SENTRY_PROJECT,
  authToken: env.VITE_SENTRY_AUTH_TOKEN,
  telemetry: false,
  sourceMapsUploadOptions: {
    release: { name: env.VITE_RELEASE_SHA },
  },
  release: {
    name: env.VITE_RELEASE_SHA,
  },
  unstable_sentryVitePluginOptions: {
    // This value is somehow ignored by Sentry, instead it's using the SENTRY_URL env var if set, 
    // or uses sentry.io otherwise.
    url: env.VITE_SENTRY_URL,
    applicationKey: 'store',
    disable: disableSentry(),
    release: {
      uploadLegacySourcemaps: { paths: ['build'], ext: ['js', 'map', 'mjs'] },
      name: env.VITE_RELEASE_SHA,
      dist: env.VITE_RELEASE_SHA,
    },
  },
};
```

### Steps to Reproduce

Set a value for `unstable_sentryVitePluginOptions.url`




### Expected Result

Sourcemaps are uploaded to the sentry instance defined in `unstable_sentryVitePluginOptions.url`.


### Actual Result

Uploading sourcempas fails with an authentication error. (This is because the plugin tries to upload theme to Sentry instead of our self hosted instance).

Obviously it's unstable for a reason, and we can work around it by setting the `SENTRY_URL` env var. but I'd figured I mention it for anyone else running into this. 


Discussion: Thanks for reporting! We'll fix that at some point soon-ish. For now please use the `SENTRY_URL` environment variable workaround.



Fix (patch):
diff --git a/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts b/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts
index ce45f57a8db3..d34b5394945e 100644
--- a/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts
+++ b/packages/react-router/src/vite/buildEnd/handleOnBuildEnd.ts
@@ -28,12 +28,14 @@ export const sentryOnBuildEnd: BuildEndHook = async ({ reactRouterConfig, viteCo
     release,
     sourceMapsUploadOptions = { enabled: true },
     debug = false,
+    unstable_sentryVitePluginOptions,
   } = getSentryConfig(viteConfig);
 
   const cliInstance = new SentryCli(null, {
     authToken,
     org,
     project,
+    ...unstable_sentryVitePluginOptions,
   });
   // check if release should be created
   if (release?.name) {