From d08712cd5e7d1c07ef830e03efc198a8f55f82fe Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Mon, 21 Sep 2026 10:09:45 +0200 Subject: [PATCH] feat(bundler-plugins): Export default export for bundler plugins --- .../cloudflare-autoinstrument/vite.config.ts | 4 ++-- .../test-applications/create-remix-app-v2/vite.config.ts | 4 ++-- .../e2e-tests/test-applications/node-vite/build.mjs | 4 ++-- .../react-router-8-framework/vite.config.ts | 4 ++-- .../test-applications/solidstart-2/vite.config.ts | 4 ++-- .../test-applications/sveltekit-2-svelte-5/vite.config.ts | 4 ++-- .../test-applications/tanstackstart-react/vite.config.ts | 4 ++-- packages/bundler-plugins/src/vite/index.ts | 5 +++++ packages/bundler-plugins/test/vite/public-api.test.ts | 6 +++++- packages/cloudflare/rollup.npm.config.mjs | 6 ++++++ packages/cloudflare/src/vite/index.ts | 5 +++++ packages/cloudflare/test/vite/index.test.ts | 6 +++++- packages/node/src/bundler-plugin/vite.ts | 5 +++++ packages/node/test/bundler-plugin/bundler-plugin.test.ts | 6 +++++- packages/react-router/src/vite/index.ts | 7 +++++++ packages/react-router/test/vite/plugin.test.ts | 5 +++++ packages/remix/src/vite/index.ts | 5 +++++ packages/remix/test/vite/index.test.ts | 6 +++++- packages/solidstart/rollup.npm.config.mjs | 2 ++ packages/solidstart/src/vite/index.ts | 7 +++++++ packages/solidstart/test/vite/sentrySolidStart.test.ts | 5 +++++ packages/sveltekit/rollup.npm.config.mjs | 2 ++ packages/sveltekit/src/vite/index.ts | 7 +++++++ .../sveltekit/test/vite/sentrySvelteKitPlugins.test.ts | 5 +++++ packages/tanstackstart-react/rollup.npm.config.mjs | 6 ++++++ packages/tanstackstart-react/src/vite/index.ts | 7 +++++++ .../test/vite/sentryTanstackStart.test.ts | 5 +++++ 27 files changed, 118 insertions(+), 18 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/cloudflare-autoinstrument/vite.config.ts b/dev-packages/e2e-tests/test-applications/cloudflare-autoinstrument/vite.config.ts index 397c14bb166a..f527061c855c 100644 --- a/dev-packages/e2e-tests/test-applications/cloudflare-autoinstrument/vite.config.ts +++ b/dev-packages/e2e-tests/test-applications/cloudflare-autoinstrument/vite.config.ts @@ -1,5 +1,5 @@ import { cloudflare } from '@cloudflare/vite-plugin'; -import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite'; +import sentry from '@sentry/cloudflare/vite'; import agents from 'agents/vite'; import { defineConfig } from 'vite'; @@ -7,5 +7,5 @@ import { defineConfig } from 'vite'; // Auto-instrumentation is the plugin behavior under test: it rewrites // `src/index.ts` at build time so the entry itself contains no Sentry calls. export default defineConfig({ - plugins: [agents(), cloudflare(), sentryCloudflareVitePlugin()], + plugins: [agents(), cloudflare(), sentry()], }); diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/vite.config.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/vite.config.ts index 690acdb91168..07630b6e7c26 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/vite.config.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/vite.config.ts @@ -1,5 +1,5 @@ import { vitePlugin as remix } from '@remix-run/dev'; -import { sentryRemixVitePlugin } from '@sentry/remix/vite'; +import sentry from '@sentry/remix/vite'; import { defineConfig } from 'vite'; import tsconfigPaths from 'vite-tsconfig-paths'; @@ -8,7 +8,7 @@ export default defineConfig({ remix({ ignoredRouteFiles: ['**/.*'], }), - sentryRemixVitePlugin(), + sentry(), tsconfigPaths(), ], }); diff --git a/dev-packages/e2e-tests/test-applications/node-vite/build.mjs b/dev-packages/e2e-tests/test-applications/node-vite/build.mjs index 6b3e5e267905..33b2a24e5108 100644 --- a/dev-packages/e2e-tests/test-applications/node-vite/build.mjs +++ b/dev-packages/e2e-tests/test-applications/node-vite/build.mjs @@ -12,7 +12,7 @@ import { builtinModules } from 'node:module'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; import { build } from 'vite'; -import { sentryVitePlugin } from '@sentry/node/vite'; +import sentry from '@sentry/node/vite'; const __dirname = dirname(fileURLToPath(import.meta.url)); const nodeExternals = [...builtinModules, ...builtinModules.map(m => `node:${m}`)]; @@ -21,7 +21,7 @@ rmSync(join(__dirname, 'dist'), { recursive: true, force: true }); // No auth/release/telemetry — we only care about the build-time transforms and defines. const makeSentryPlugin = () => - sentryVitePlugin({ + sentry({ telemetry: false, sourcemaps: { disable: true }, release: { create: false, finalize: false, inject: false }, diff --git a/dev-packages/e2e-tests/test-applications/react-router-8-framework/vite.config.ts b/dev-packages/e2e-tests/test-applications/react-router-8-framework/vite.config.ts index 0fe4cdde8c7a..b64d35e4a148 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-8-framework/vite.config.ts +++ b/dev-packages/e2e-tests/test-applications/react-router-8-framework/vite.config.ts @@ -1,9 +1,9 @@ import { reactRouter } from '@react-router/dev/vite'; -import { sentryReactRouter } from '@sentry/react-router/vite'; +import sentry from '@sentry/react-router/vite'; import { defineConfig } from 'vite'; export default defineConfig(config => { return { - plugins: [reactRouter(), sentryReactRouter({ sourcemaps: { disable: true } }, config)], + plugins: [reactRouter(), sentry({ sourcemaps: { disable: true } }, config)], }; }); diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts b/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts index d3ffd97997a9..30dfcafe6634 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts @@ -1,4 +1,4 @@ -import { sentrySolidStart } from '@sentry/solidstart/vite'; +import sentry from '@sentry/solidstart/vite'; import { solidStart } from '@solidjs/start/config'; import { nitro } from 'nitro/vite'; import { defineConfig } from 'vite'; @@ -9,7 +9,7 @@ export default defineConfig({ appRoot: './src', middleware: './src/middleware.ts', }), - sentrySolidStart({ + sentry({ org: process.env.E2E_TEST_SENTRY_ORG_SLUG, project: process.env.E2E_TEST_SENTRY_PROJECT, authToken: process.env.E2E_TEST_AUTH_TOKEN, diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/vite.config.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/vite.config.ts index be8b485d022a..6208c74e5ed6 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/vite.config.ts +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/vite.config.ts @@ -1,10 +1,10 @@ -import { sentrySvelteKit } from '@sentry/sveltekit/vite'; +import sentry from '@sentry/sveltekit/vite'; import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig } from 'vite'; export default defineConfig({ plugins: [ - sentrySvelteKit({ + sentry({ autoUploadSourceMaps: false, }), sveltekit(), diff --git a/dev-packages/e2e-tests/test-applications/tanstackstart-react/vite.config.ts b/dev-packages/e2e-tests/test-applications/tanstackstart-react/vite.config.ts index 2385d8aa5e93..7540efc5a307 100644 --- a/dev-packages/e2e-tests/test-applications/tanstackstart-react/vite.config.ts +++ b/dev-packages/e2e-tests/test-applications/tanstackstart-react/vite.config.ts @@ -3,7 +3,7 @@ import tsConfigPaths from 'vite-tsconfig-paths'; import { tanstackStart } from '@tanstack/react-start/plugin/vite'; import viteReact from '@vitejs/plugin-react-swc'; import { nitro } from 'nitro/vite'; -import { sentryTanstackStart } from '@sentry/tanstackstart-react/vite'; +import sentry from '@sentry/tanstackstart-react/vite'; const tunnelRouteMode = process.env.E2E_TEST_TUNNEL_ROUTE_MODE ?? 'off'; const useManagedTunnelRoute = tunnelRouteMode !== 'off'; @@ -49,7 +49,7 @@ export default defineConfig({ nitro(), // react's vite plugin must come after start's vite plugin viteReact(), - sentryTanstackStart({ + sentry({ org: process.env.E2E_TEST_SENTRY_ORG_SLUG, project: process.env.E2E_TEST_SENTRY_PROJECT, authToken: process.env.E2E_TEST_AUTH_TOKEN, diff --git a/packages/bundler-plugins/src/vite/index.ts b/packages/bundler-plugins/src/vite/index.ts index ea24f64e5d73..2a1d6dea7163 100644 --- a/packages/bundler-plugins/src/vite/index.ts +++ b/packages/bundler-plugins/src/vite/index.ts @@ -31,3 +31,8 @@ export const sentryVitePlugin = (options?: SentryRollupPluginOptions): SentryVit }; export type { Options as SentryVitePluginOptions } from '../core'; + +/** + * Default export of `@sentry/bundler-plugins/vite`. It is the same function as {@link sentryVitePlugin}. + */ +export default sentryVitePlugin; diff --git a/packages/bundler-plugins/test/vite/public-api.test.ts b/packages/bundler-plugins/test/vite/public-api.test.ts index 6f8dd9f84260..def3cbd580b7 100644 --- a/packages/bundler-plugins/test/vite/public-api.test.ts +++ b/packages/bundler-plugins/test/vite/public-api.test.ts @@ -1,4 +1,4 @@ -import { sentryVitePlugin } from '../../src/vite'; +import sentryVitePluginDefault, { sentryVitePlugin } from '../../src/vite'; import { describe, it, expect, test, beforeEach, vi } from 'vitest'; test('Vite plugin should exist', () => { @@ -11,6 +11,10 @@ describe('sentryVitePlugin', () => { vi.clearAllMocks(); }); + it('is the default export of the vite entry point', () => { + expect(sentryVitePluginDefault).toBe(sentryVitePlugin); + }); + it('returns an array of Vite plugins', () => { const plugins = sentryVitePlugin({ authToken: 'test-token', diff --git a/packages/cloudflare/rollup.npm.config.mjs b/packages/cloudflare/rollup.npm.config.mjs index ae10666a0db7..f917209f8c0c 100644 --- a/packages/cloudflare/rollup.npm.config.mjs +++ b/packages/cloudflare/rollup.npm.config.mjs @@ -3,6 +3,12 @@ import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollu export default makeNPMConfigVariants( makeBaseNPMConfig({ entrypoints: ['src/index.ts', 'src/request.ts', 'src/vite/index.ts', 'src/orchestrion-diagnostics-channel.ts'], + packageSpecificConfig: { + output: { + // make it so Rollup calms down about the fact that we're combining default and named exports + exports: 'named', + }, + }, }), { splitDevProd: true }, ); diff --git a/packages/cloudflare/src/vite/index.ts b/packages/cloudflare/src/vite/index.ts index be679c4823f5..b83693d8d307 100644 --- a/packages/cloudflare/src/vite/index.ts +++ b/packages/cloudflare/src/vite/index.ts @@ -96,3 +96,8 @@ export function sentryCloudflareVitePlugin(options: SentryCloudflareVitePluginOp : []), ]; } + +/** + * Default export of `@sentry/cloudflare/vite`. It is the same function as {@link sentryCloudflareVitePlugin}. + */ +export default sentryCloudflareVitePlugin; diff --git a/packages/cloudflare/test/vite/index.test.ts b/packages/cloudflare/test/vite/index.test.ts index 8559ef1123c6..cf1fb084945c 100644 --- a/packages/cloudflare/test/vite/index.test.ts +++ b/packages/cloudflare/test/vite/index.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { sentryCloudflareVitePlugin } from '../../src/vite/index'; +import sentryCloudflareVitePluginDefault, { sentryCloudflareVitePlugin } from '../../src/vite/index'; const AUTO_INSTRUMENT_PLUGIN = 'sentry-cloudflare-auto-instrument'; @@ -8,6 +8,10 @@ function pluginNames(options?: Parameters[0]) } describe('sentryCloudflareVitePlugin', () => { + it('is the default export of the vite entry point', () => { + expect(sentryCloudflareVitePluginDefault).toBe(sentryCloudflareVitePlugin); + }); + it('enables auto-instrumentation by default', () => { expect(pluginNames()).toContain(AUTO_INSTRUMENT_PLUGIN); }); diff --git a/packages/node/src/bundler-plugin/vite.ts b/packages/node/src/bundler-plugin/vite.ts index 74a54e6ce17b..51bf277620f3 100644 --- a/packages/node/src/bundler-plugin/vite.ts +++ b/packages/node/src/bundler-plugin/vite.ts @@ -40,3 +40,8 @@ export function sentryVitePlugin(options?: SentryVitePluginOptions): VitePlugin[ const bundlerPlugins = sentryViteBundlerPlugin(options); return [...bundlerPlugins, sentryOrchestrionPlugin(options)]; } + +/** + * Default export of `@sentry/node/vite`. It is the same function as {@link sentryVitePlugin}. + */ +export default sentryVitePlugin; diff --git a/packages/node/test/bundler-plugin/bundler-plugin.test.ts b/packages/node/test/bundler-plugin/bundler-plugin.test.ts index dd50cffca04e..ec3140b09ab1 100644 --- a/packages/node/test/bundler-plugin/bundler-plugin.test.ts +++ b/packages/node/test/bundler-plugin/bundler-plugin.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { sentryEsbuildPlugin } from '../../src/bundler-plugin/esbuild'; import { sentryRollupPlugin } from '../../src/bundler-plugin/rollup'; -import { sentryVitePlugin } from '../../src/bundler-plugin/vite'; +import sentryVitePluginDefault, { sentryVitePlugin } from '../../src/bundler-plugin/vite'; import { sentryWebpackPlugin } from '../../src/bundler-plugin/webpack'; const orchestrionVite = vi.fn(() => ({ name: 'sentry-orchestrion-vite' })); @@ -30,6 +30,10 @@ describe('@sentry/node bundler plugins', () => { vi.clearAllMocks(); }); + it('is the default export of the vite entry point', () => { + expect(sentryVitePluginDefault).toBe(sentryVitePlugin); + }); + // The wrappers always wire in the orchestrion plugin. Opting out via // `buildTimeInstrumentation: false` is handled inside the orchestrion plugin // itself (covered in @sentry/server-utils), which returns an inert plugin. diff --git a/packages/react-router/src/vite/index.ts b/packages/react-router/src/vite/index.ts index 5f5b6266015a..1675bb33e419 100644 --- a/packages/react-router/src/vite/index.ts +++ b/packages/react-router/src/vite/index.ts @@ -1,4 +1,11 @@ +import { sentryReactRouter } from './plugin'; + export { sentryReactRouter } from './plugin'; export { sentryOnBuildEnd } from './buildEnd/handleOnBuildEnd'; export type { SentryReactRouterBuildOptions } from './types'; export { makeConfigInjectorPlugin } from './makeConfigInjectorPlugin'; + +/** + * Default export of `@sentry/react-router/vite`. It is the same function as {@link sentryReactRouter}. + */ +export default sentryReactRouter; diff --git a/packages/react-router/test/vite/plugin.test.ts b/packages/react-router/test/vite/plugin.test.ts index 52cbecceb9a9..d994ffa7f566 100644 --- a/packages/react-router/test/vite/plugin.test.ts +++ b/packages/react-router/test/vite/plugin.test.ts @@ -3,6 +3,7 @@ import { makeConfigInjectorPlugin } from '../../src/vite/makeConfigInjectorPlugi import { makeCustomSentryVitePlugins } from '../../src/vite/makeCustomSentryVitePlugins'; import { makeEnableSourceMapsPlugin } from '../../src/vite/makeEnableSourceMapsPlugin'; import { makeServerBuildCapturePlugin } from '../../src/vite/makeServerBuildCapturePlugin'; +import sentryReactRouterDefault from '../../src/vite'; import { sentryReactRouter } from '../../src/vite/plugin'; vi.spyOn(console, 'log').mockImplementation(() => { @@ -45,6 +46,10 @@ describe('sentryReactRouter', () => { vi.resetModules(); }); + it('is the default export of the vite entry point', () => { + expect(sentryReactRouterDefault).toBe(sentryReactRouter); + }); + it('should return sentry config injector plugin in development mode', async () => { const originalNodeEnv = process.env.NODE_ENV; process.env.NODE_ENV = 'development'; diff --git a/packages/remix/src/vite/index.ts b/packages/remix/src/vite/index.ts index b38abdda0c80..3014c19048a4 100644 --- a/packages/remix/src/vite/index.ts +++ b/packages/remix/src/vite/index.ts @@ -57,3 +57,8 @@ export function sentryRemixVitePlugin(options: SentryRemixVitePluginOptions = {} return plugins; } + +/** + * Default export of `@sentry/remix/vite`. It is the same function as {@link sentryRemixVitePlugin}. + */ +export default sentryRemixVitePlugin; diff --git a/packages/remix/test/vite/index.test.ts b/packages/remix/test/vite/index.test.ts index c105a19789df..cb65afb2ea7d 100644 --- a/packages/remix/test/vite/index.test.ts +++ b/packages/remix/test/vite/index.test.ts @@ -1,6 +1,6 @@ import type { ConfigEnv, UserConfig } from 'vite'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { sentryRemixVitePlugin } from '../../src/vite'; +import sentryRemixVitePluginDefault, { sentryRemixVitePlugin } from '../../src/vite'; // Stub the orchestrion plugin so these stay pure wiring tests (no apm code transformer pulled in), // mirroring the real plugin's two shapes. @@ -67,6 +67,10 @@ function callHook(hook: unknown, ...args: unknown[]): unknown { } describe('sentryRemixVitePlugin', () => { + it('is the default export of the vite entry point', () => { + expect(sentryRemixVitePluginDefault).toBe(sentryRemixVitePlugin); + }); + beforeEach(() => { vi.clearAllMocks(); vi.unstubAllEnvs(); diff --git a/packages/solidstart/rollup.npm.config.mjs b/packages/solidstart/rollup.npm.config.mjs index d28b29896b10..50d4135427c6 100644 --- a/packages/solidstart/rollup.npm.config.mjs +++ b/packages/solidstart/rollup.npm.config.mjs @@ -20,6 +20,8 @@ export default makeNPMConfigVariants( external: ['solid-js/web', 'solid-js', '@sentry/solid', '@sentry/solid/solidrouter'], output: { dynamicImportInCjs: true, + // make it so Rollup calms down about the fact that we're combining default and named exports + exports: 'named', }, }, }), diff --git a/packages/solidstart/src/vite/index.ts b/packages/solidstart/src/vite/index.ts index b23359c06ba5..026dfae297fb 100644 --- a/packages/solidstart/src/vite/index.ts +++ b/packages/solidstart/src/vite/index.ts @@ -1,2 +1,9 @@ +import { sentrySolidStart } from './sentrySolidStart'; + export { sentrySolidStart } from './sentrySolidStart'; export type { SentrySolidStartOptions } from './sentrySolidStart'; + +/** + * Default export of `@sentry/solidstart/vite`. It is the same function as {@link sentrySolidStart}. + */ +export default sentrySolidStart; diff --git a/packages/solidstart/test/vite/sentrySolidStart.test.ts b/packages/solidstart/test/vite/sentrySolidStart.test.ts index 75076c3ba99c..ed3a69008688 100644 --- a/packages/solidstart/test/vite/sentrySolidStart.test.ts +++ b/packages/solidstart/test/vite/sentrySolidStart.test.ts @@ -4,6 +4,7 @@ import type { Plugin, UserConfig } from 'vite'; import { mergeConfig } from 'vite'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import sentrySolidStartDefault from '../../src/vite'; import { sentrySolidStart } from '../../src/vite/sentrySolidStart'; vi.spyOn(console, 'log').mockImplementation(() => { @@ -45,6 +46,10 @@ afterEach(() => { }); describe('sentrySolidStart()', () => { + it('is the default export of the vite entry point', () => { + expect(sentrySolidStartDefault).toBe(sentrySolidStart); + }); + it('returns the nitro, orchestrion and source maps plugins', () => { const names = sentrySolidStart({ org: 'org', project: 'project', authToken: 'token' }).map(plugin => plugin.name); diff --git a/packages/sveltekit/rollup.npm.config.mjs b/packages/sveltekit/rollup.npm.config.mjs index 331f396b7075..d0a027c7aa85 100644 --- a/packages/sveltekit/rollup.npm.config.mjs +++ b/packages/sveltekit/rollup.npm.config.mjs @@ -22,6 +22,8 @@ export default makeNPMConfigVariants( external: ['$app/state', '$app/stores', '@sentry/sveltekit/browser-tracing-variant', 'cloudflare:workers'], output: { dynamicImportInCjs: true, + // make it so Rollup calms down about the fact that we're combining default and named exports + exports: 'named', }, }, }), diff --git a/packages/sveltekit/src/vite/index.ts b/packages/sveltekit/src/vite/index.ts index c9c5beecef28..56d47bd18112 100644 --- a/packages/sveltekit/src/vite/index.ts +++ b/packages/sveltekit/src/vite/index.ts @@ -1 +1,8 @@ +import { sentrySvelteKit } from './sentryVitePlugins'; + export { sentrySvelteKit } from './sentryVitePlugins'; + +/** + * Default export of `@sentry/sveltekit/vite`. It is the same function as {@link sentrySvelteKit}. + */ +export default sentrySvelteKit; diff --git a/packages/sveltekit/test/vite/sentrySvelteKitPlugins.test.ts b/packages/sveltekit/test/vite/sentrySvelteKitPlugins.test.ts index 8a4c22597c2c..5724104bbfeb 100644 --- a/packages/sveltekit/test/vite/sentrySvelteKitPlugins.test.ts +++ b/packages/sveltekit/test/vite/sentrySvelteKitPlugins.test.ts @@ -1,5 +1,6 @@ import type { Plugin } from 'vite'; import { describe, expect, it, vi } from 'vitest'; +import sentrySvelteKitDefault from '../../src/vite'; import * as autoInstrument from '../../src/vite/autoInstrument'; import { generateVitePluginOptions, sentrySvelteKit } from '../../src/vite/sentryVitePlugins'; import * as sourceMaps from '../../src/vite/sourceMaps'; @@ -40,6 +41,10 @@ function getSentrySvelteKitPlugins(options?: Parameters[ } describe('sentrySvelteKit()', () => { + it('is the default export of the vite entry point', () => { + expect(sentrySvelteKitDefault).toBe(sentrySvelteKit); + }); + it('warns when the removed `unstable_sentryVitePluginOptions` is still set', async () => { consoleWarnSpy.mockClear(); diff --git a/packages/tanstackstart-react/rollup.npm.config.mjs b/packages/tanstackstart-react/rollup.npm.config.mjs index 61de8d9176f6..205127763047 100644 --- a/packages/tanstackstart-react/rollup.npm.config.mjs +++ b/packages/tanstackstart-react/rollup.npm.config.mjs @@ -10,6 +10,12 @@ export default [ 'src/server/index.ts', 'src/vite/index.ts', ], + packageSpecificConfig: { + output: { + // make it so Rollup calms down about the fact that we're combining default and named exports + exports: 'named', + }, + }, }), ), ...makeOrchestrionLoader('./build'), diff --git a/packages/tanstackstart-react/src/vite/index.ts b/packages/tanstackstart-react/src/vite/index.ts index b7f65e26f5d2..76e9fcc4b277 100644 --- a/packages/tanstackstart-react/src/vite/index.ts +++ b/packages/tanstackstart-react/src/vite/index.ts @@ -1,3 +1,10 @@ +import { sentryTanstackStart } from './sentryTanstackStart'; + export { sentryTanstackStart } from './sentryTanstackStart'; export type { SentryTanstackStartOptions } from './sentryTanstackStart'; export type { TunnelRouteOptions } from './tunnelRoute'; + +/** + * Default export of `@sentry/tanstackstart-react/vite`. It is the same function as {@link sentryTanstackStart}. + */ +export default sentryTanstackStart; diff --git a/packages/tanstackstart-react/test/vite/sentryTanstackStart.test.ts b/packages/tanstackstart-react/test/vite/sentryTanstackStart.test.ts index 0715873cdfa5..2abd832025d9 100644 --- a/packages/tanstackstart-react/test/vite/sentryTanstackStart.test.ts +++ b/packages/tanstackstart-react/test/vite/sentryTanstackStart.test.ts @@ -1,4 +1,5 @@ import type { Plugin } from 'vite'; +import sentryTanstackStartDefault from '../../src/vite'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { makeAutoInstrumentMiddlewarePlugin } from '../../src/vite/autoInstrumentMiddleware'; import { sentryTanstackStart, type SentryTanstackStartOptions } from '../../src/vite/sentryTanstackStart'; @@ -79,6 +80,10 @@ describe('sentryTanstackStart()', () => { process.env.NODE_ENV = 'production'; }); + it('is the default export of the vite entry point', () => { + expect(sentryTanstackStartDefault).toBe(sentryTanstackStart); + }); + describe('source maps', () => { it('returns source maps plugins in production mode', () => { const plugins = sentryTanstackStart({ autoInstrumentMiddleware: false });