Skip to content

Conversation

@nicohrubec
Copy link
Member

@nicohrubec nicohrubec commented Jan 7, 2026

Adds wrapConfigWithSentry vite config wrapper 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. solid start). On a high-level it:

  • Uploads source maps to Sentry using @sentry/vite-plugin if configured, mainly passing through the options set by the user
  • 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 upload

Usage

  // vite.config.ts
  import { defineConfig } from 'vite';
  import { wrapConfigWithSentry } from '@sentry/tanstackstart-react';

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

Tests

  • Added unit tests for sourceMaps.ts and addSentryPlugins.ts covering plugin composition, options passing, and source map settings logic
  • Updated the E2E test to use the wrapper (although no explicit checks are done there)

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,782 - 8,543 +3%
GET With Sentry 1,701 19% 1,637 +4%
GET With Sentry (error only) 6,099 69% 5,691 +7%
POST Baseline 1,174 - 1,129 +4%
POST With Sentry 595 51% 545 +9%
POST With Sentry (error only) 1,036 88% 987 +5%
MYSQL Baseline 3,248 - 3,104 +5%
MYSQL With Sentry 448 14% 456 -2%
MYSQL With Sentry (error only) 2,672 82% 2,502 +7%

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:

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.

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

3 participants