Skip to content

Commit

Permalink
separate replay
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Nov 12, 2023
1 parent 743966b commit 0f66aa8
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 23 deletions.
7 changes: 6 additions & 1 deletion .size-limit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ module.exports = [
path: 'size-check/base/.nuxt/dist/client/',
gzip: false,
},
{
name: 'fixture: replay',
path: 'size-check/replay/.nuxt/dist/client/',
gzip: false,
},
{
name: 'fixture: lazy',
path: 'size-check/lazy/.nuxt/dist/client/',
Expand All @@ -20,7 +25,7 @@ module.exports = [
gzip: false,
},
{
name: 'fixture: typescript (+replay)',
name: 'fixture: typescript',
path: 'size-check/typescript/.nuxt/dist/client/',
gzip: false,
},
Expand Down
1 change: 1 addition & 0 deletions size-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"scripts": {
"build": "run-p build:*",
"build:base": "nuxt build -c ./base/nuxt.config",
"build:replay": "nuxt build -c ./replay/nuxt.config",
"build:tracing": "nuxt build -c ./tracing/nuxt.config",
"build:lazy": "nuxt build -c ./lazy/nuxt.config",
"build:lazy+tracing": "nuxt build -c ./lazy+tracing/nuxt.config",
Expand Down
21 changes: 21 additions & 0 deletions size-check/replay/nuxt.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const SentryModule = require('../..')

/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://[email protected]/1429779',
clientIntegrations: {
// Integration from @Sentry/browser package.
TryCatch: { eventTarget: false },
Replay: {},
},

},
}

module.exports = config
36 changes: 36 additions & 0 deletions size-check/replay/pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>

<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
}
</script>
6 changes: 0 additions & 6 deletions size-check/typescript/config/custom-client-integrations.ts

This file was deleted.

16 changes: 0 additions & 16 deletions size-check/typescript/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,6 @@ const config: NuxtConfig = {
],
sentry: {
dsn: 'https://[email protected]/1429779',
clientIntegrations: {
// Integration from @Sentry/browser package.
TryCatch: { eventTarget: false },
Replay: {},
},
clientConfig: {
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
},
customClientIntegrations: '~/config/custom-client-integrations.ts',
serverConfig: '~/config/server.config',
tracing: true,
},
typescript: {
typeCheck: false,
Expand Down

0 comments on commit 0f66aa8

Please sign in to comment.