Skip to content

Commit b4c1312

Browse files
authored
fix: don't shutdown Sentry SDK after build in dev mode (#555)
1 parent 4bdd341 commit b4c1312

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build:
14-
name: Use Node.js ${{ matrix.node-version }}
14+
name: Lint and test
1515
runs-on: ubuntu-latest
1616
env:
1717
CI: true

src/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,15 @@ export async function initializeServerSentry (nuxt: Nuxt, moduleOptions: ModuleC
149149
const serverOptions = await resolveServerOptions(nuxt, moduleOptions, logger)
150150
const config: Options = defu({ release }, serverOptions.config)
151151

152+
process.sentry = Sentry
153+
152154
if (canInitialize(moduleOptions)) {
153155
Sentry.init(config)
154156
sentryHandlerProxy.errorHandler = Sentry.Handlers.errorHandler()
155157
sentryHandlerProxy.requestHandler = Sentry.Handlers.requestHandler(moduleOptions.requestHandlerConfig)
156158
if (serverOptions.tracing) {
157159
sentryHandlerProxy.tracingHandler = Sentry.Handlers.tracingHandler()
158160
}
159-
160-
process.sentry = Sentry
161161
}
162162
}
163163

src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default defineNuxtModule<ModuleConfiguration>({
141141
// the release version has been determined and the options template created but before
142142
// the build is started (if building).
143143
if (isNuxt2()) {
144-
const isBuilding = nuxt.options._build
144+
const isBuilding = nuxt.options._build && !nuxt.options.dev
145145
const initHook = isBuilding ? 'build:compile' : 'ready'
146146
nuxt.hook(initHook, () => initializeServerSentry(nuxt, options, sentryHandlerProxy, logger))
147147
const shutdownHook = isBuilding ? 'build:done' : 'close'

0 commit comments

Comments
 (0)