-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Problem Statement
The latest install docs https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/ have been simplified but require an instrument.server.mjs and require cp instructions in packahe.json
This is messy
Solution Brainstorm
export a vite plugin from the package that automates this.
import { build, type Plugin } from 'vite';
export interface BuildInstrumentOptions {
entry?: string;
outDir?: string;
fileName?: string;
external?: (string | RegExp)[];
}
export const buildSentryInstrumentation = (options?: BuildInstrumentOptions): Plugin => {
const { entry = './src/instrument.server.ts', outDir = '.output', fileName = 'server/instrument.server.mjs', external = [/node_modules/] } = options ?? {};
return {
name: 'build-instrument',
apply: 'build',
closeBundle: async () => {
await build({
configFile: false,
build: {
ssr: true,
outDir,
emptyOutDir: false,
lib: {
entry,
formats: ['es'],
fileName: () => fileName,
},
rollupOptions: {
external,
output: {
entryFileNames: fileName,
},
},
},
});
},
};
};Additional Context
I'm happy to generate a PR for this
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Labels
Projects
Status
Waiting for: Product Owner