Skip to content

Commit

Permalink
ref(nuxt): Add instument.server.mjs to preview script (#38)
Browse files Browse the repository at this point in the history
* add instument.server.mjs

* add sourcemaps options

* add yarn.lock
  • Loading branch information
s1gr1d authored Jul 26, 2024
1 parent 32a1198 commit 021592b
Show file tree
Hide file tree
Showing 10 changed files with 2,333 additions and 3,392 deletions.
9 changes: 9 additions & 0 deletions apps/nuxt/components/ErrorButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup>
const triggerError = () => {
throw new Error('Nuxt Button Error');
};
</script>

<template>
<button id="errorBtn" @click="triggerError">Trigger Error</button>
</template>
8 changes: 8 additions & 0 deletions apps/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@sentry/nuxt/module'],
sentry:{
debug: false,
sourceMapsUploadOptions: {
org: "org",
project: "proj",
authToken: process.env.SENTRY_AUTH_TOKEN,
},
},
debug: false,
});
6 changes: 4 additions & 2 deletions apps/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"preview": "NODE_OPTIONS='--import ./public/instrument.server.mjs' nuxt preview",
"postinstall": "nuxt prepare",
"clean": "npx nuxi cleanup"
},
"dependencies": {
"@sentry/nuxt": "8.17.0",
"@sentry/nuxt": "8.20.0",
"nuxt": "^3.12.2"
},
"//": {
Expand All @@ -20,6 +20,8 @@
"@sentry/core": "file:.yalc/@sentry/core",
"@sentry/node": "file:.yalc/@sentry/node",
"@sentry/nuxt": "file:.yalc/@sentry/nuxt",
"@sentry/opentelemetry": "file:.yalc/@sentry/opentelemetry",
"@sentry/types": "file:.yalc/@sentry/types",
"@sentry/utils": "file:.yalc/@sentry/utils",
"@sentry/vue": "file:.yalc/@sentry/vue"
}
Expand Down
7 changes: 7 additions & 0 deletions apps/nuxt/pages/client-error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script setup>
import ErrorButton from '../components/ErrorButton.vue';
</script>

<template>
<ErrorButton />
</template>
14 changes: 2 additions & 12 deletions apps/nuxt/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<template>
<div><button @click="triggerError">Trigger Error</button><br /></div>
</template>

<script>
export default {
methods: {
triggerError() {
throw new Error('This is a test error for Sentry');
},
},
};
</script>
<h1>Hello!</h1>
</template>
1 change: 1 addition & 0 deletions apps/nuxt/pages/test-param/[param].vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<template>
<p>{{ $route.params.param }} - {{ $route.params.param }}</p>
<ErrorButton />
</template>
9 changes: 9 additions & 0 deletions apps/nuxt/public/instrument.server.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as Sentry from '@sentry/nuxt';

if(process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1,
debug: true,
});
}
3 changes: 1 addition & 2 deletions apps/nuxt/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ import * as Sentry from '@sentry/nuxt';
Sentry.init({
dsn: 'your-dsn',
debug: true,
tracesSampleRate: 1,
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1
});
7 changes: 0 additions & 7 deletions apps/nuxt/sentry.server.config.js

This file was deleted.

Loading

0 comments on commit 021592b

Please sign in to comment.