Skip to content

Conversation

@nicohrubec
Copy link
Member

@nicohrubec nicohrubec commented Jan 7, 2026

Adds sentryTanstackStart Vite plugin to enable automatic source map uploads in TanStack Start applications.

What it does
I tried to align with what we do in other SDKs (e.g. SvelteKit). On a high-level it:

  • Uploads source maps to Sentry using @sentry/vite-plugin if configured, passing through all options set by the user (including release, sourcemaps, headers, etc.)
  • If the source maps option is not defined and also the files to delete option is not defined, we enable cleaning up all .map files after the source map upload
  • If the source map configuration is undefined, we additionally enable hidden source map generation

Usage

// vite.config.ts
  import { defineConfig } from 'vite';
  import { sentryTanstackStart } from '@sentry/tanstackstart-react';
  import { tanstackStart } from '@tanstack/react-start/plugin/vite';

  export default defineConfig({
    plugins: [
      sentryTanstackStart({
        org: 'my-org',
        project: 'my-project',
        // authToken via SENTRY_AUTH_TOKEN env var
      }),
      tanstackStart(),
    ],
  });

Tests

  • Added unit tests for sourceMaps.ts and sentryTanstackStart.ts covering plugin composition, options passing, and source map settings logic
  • Updated the E2E test to use the new plugin pattern

Closes #18664

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,867 - 9,365 -5%
GET With Sentry 1,738 20% 1,732 +0%
GET With Sentry (error only) 6,098 69% 6,087 +0%
POST Baseline 1,193 - 1,172 +2%
POST With Sentry 595 50% 592 +1%
POST With Sentry (error only) 1,058 89% 1,059 -0%
MYSQL Baseline 3,370 - 3,300 +2%
MYSQL With Sentry 477 14% 493 -3%
MYSQL With Sentry (error only) 2,703 80% 2,710 -0%

View base workflow run

@nicohrubec nicohrubec changed the title feat(tanstackstart-react): Add vite config wrapper feat(tanstackstart-react): Add Vite Config Wrapper for Source Map Uploads Jan 8, 2026
@nicohrubec nicohrubec marked this pull request as ready for review January 8, 2026 08:37
/**
* Build options for the Sentry plugin. These options are used during build-time by the Sentry SDK.
*/
export type SentryTanstackStartReactPluginOptions = {
Copy link
Member

Choose a reason for hiding this comment

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

You can/should extend from this type, so we can make sure that all build-time options are aligned:

Copy link
Member Author

Choose a reason for hiding this comment

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

ah nice thanks I did not know that existed, updated

if (process.env.NODE_ENV !== 'development') {
// Check if source maps upload is enabled
// Default to enabled
const sourceMapsEnabled = options.sourceMapsUploadOptions?.enabled ?? true;
Copy link
Member

Choose a reason for hiding this comment

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

You probably want to use options.sourcemaps.disable here. Also make sure people can still create a release, even if they don't want to upload source maps.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated to use disable

Copy link
Member Author

Choose a reason for hiding this comment

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

also always adding the sentry vite plugin down passing down the source maps disable option so that release creation works also if people do not use source maps

@s1gr1d
Copy link
Member

s1gr1d commented Jan 12, 2026

A general thought I had on this: Are the sources included in Nitro source maps? In the Nuxt SDK, we have to disable this setting:

nitroConfig.rollupConfig.output.sourcemapExcludeSources = false;

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Naive question for now: What's the advantage over this wrapper that we can't achieve with just exporting a plugin? If we need to modify the vite config, Vite offers plugin hooks to do so from within a plugin.

I'd personally prefer the plugin approach because this is a pattern that users are more used to than wrapping their config. If you or anyone else has different opinions, let's hear it :D

@nicohrubec
Copy link
Member Author

nicohrubec commented Jan 14, 2026

@Lms24 good call, changed the approach from a wrapper to a simple plugin that users can add

@nicohrubec
Copy link
Member Author

nicohrubec commented Jan 14, 2026

@s1gr1d judging from here and here that option seems to default to false in the vite rollup build options, so seems fine I think?

@nicohrubec nicohrubec requested review from Lms24 and s1gr1d January 14, 2026 15:25
@nicohrubec nicohrubec changed the title feat(tanstackstart-react): Add Vite Config Wrapper for Source Map Uploads feat(tanstackstart-react): Add sentryTanstackStart Vite plugin for Source Map Uploads Jan 14, 2026
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.

Automatically enable source maps upload from vite config wrapper

4 participants