Skip to content

Commit 704a781

Browse files
committed
Add placeholder vite config wrapper
1 parent 497a0b5 commit 704a781

5 files changed

Lines changed: 90 additions & 6 deletions

File tree

packages/tanstackstart-react/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
"@sentry/node": "10.32.1",
5858
"@sentry/react": "10.32.1"
5959
},
60+
"devDependencies": {
61+
"vite": "^5.4.11"
62+
},
6063
"scripts": {
6164
"build": "run-p build:transpile build:types",
6265
"build:dev": "yarn build",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export {};
1+
export * from './types';
2+
export { wrapConfigWithSentry } from './wrapConfigWithSentry';
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
type SourceMapsOptions = {
2+
/**
3+
* If this flag is `true`, and an auth token is detected, the Sentry SDK will
4+
* automatically generate and upload source maps to Sentry during a production build.
5+
*
6+
* @default true
7+
*/
8+
enabled?: boolean;
9+
10+
/**
11+
* If this flag is `true`, the Sentry plugin will collect some telemetry data and send it to Sentry.
12+
* It will not collect any sensitive or user-specific data.
13+
*
14+
* @default true
15+
*/
16+
telemetry?: boolean;
17+
18+
/**
19+
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact
20+
* upload to Sentry has been completed.
21+
*
22+
* @default [] - By default no files are deleted.
23+
*
24+
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
25+
*/
26+
filesToDeleteAfterUpload?: string | Array<string>;
27+
};
28+
29+
/**
30+
* Build options for the Sentry plugin. These options are used during build-time by the Sentry SDK.
31+
*/
32+
export type SentryTanstackStartReactPluginOptions = {
33+
/**
34+
* The auth token to use when uploading source maps to Sentry.
35+
*
36+
* Instead of specifying this option, you can also set the `SENTRY_AUTH_TOKEN` environment variable.
37+
*
38+
* To create an auth token, follow this guide:
39+
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
40+
*/
41+
authToken?: string;
42+
43+
/**
44+
* The organization slug of your Sentry organization.
45+
* Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
46+
*/
47+
org?: string;
48+
49+
/**
50+
* The project slug of your Sentry project.
51+
* Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
52+
*/
53+
project?: string;
54+
55+
/**
56+
* Options for the Sentry Vite plugin to customize the source maps upload process.
57+
*/
58+
sourceMapsUploadOptions?: SourceMapsOptions;
59+
60+
/**
61+
* Enable debug functionality of the SDK during build-time.
62+
* Enabling this will give you, for example logs about source maps.
63+
*/
64+
debug?: boolean;
65+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { UserConfig } from 'vite';
2+
import type { SentryTanstackStartReactPluginOptions } from './types';
3+
4+
/**
5+
* Wraps a Vite configuration with Sentry build-time enhancements such as
6+
* automatic source maps upload.
7+
*
8+
* @param config - A Vite configuration object
9+
* @param sentryPluginOptions - Options to configure the Sentry Vite plugin
10+
* @returns The modified Vite config
11+
*/
12+
export function wrapConfigWithSentry(
13+
config: UserConfig,
14+
_sentryPluginOptions: SentryTanstackStartReactPluginOptions = {},
15+
): UserConfig {
16+
// TODO: Add Sentry Vite plugins for source map upload
17+
console.log('wrapConfigWithSentry', config, _sentryPluginOptions);
18+
return config;
19+
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
22
"extends": "../../tsconfig.json",
33
"include": ["src/**/*"],
4-
"compilerOptions": {
5-
"lib": ["es2020"],
6-
"module": "Node16",
7-
"moduleResolution": "Node16"
8-
}
4+
"compilerOptions": {}
95
}

0 commit comments

Comments
 (0)