Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Remix): Added Spotlight option in server config #547

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Add note about `tunnelRoute` and Next.js middleware incompatibility (#544)
- feat(remix): Added comment to add spotlight in Sentry.init for remix server config (#547)

## 3.20.5

Expand Down
14 changes: 9 additions & 5 deletions src/remix/sdk-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,14 @@ function insertServerInitCall(
dsn: string,
originalHooksMod: ProxifiedModule<any>,
) {
const initCall = builders.functionCall('Sentry.init', {
dsn,
tracesSampleRate: 1.0,
});
const code = [
"Sentry.init({",
` dsn: "${dsn}",`,
" tracesSampleRate: 1.0,",
" // uncomment the line below to enable Spotlight (https://spotlightjs.com)",
" // spotlight: process.env.NODE_ENV === 'development',",
"});"
].join("\n");

const originalHooksModAST = originalHooksMod.$ast as Program;

Expand All @@ -116,7 +120,7 @@ function insertServerInitCall(
0,
// @ts-expect-error - string works here because the AST is proxified by magicast
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
generateCode(initCall).code,
code,
);
}

Expand Down