Skip to content

Commit 511f7f2

Browse files
committed
fix(nuxt): Re-export all exported bindings
1 parent 146e7dc commit 511f7f2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: packages/nuxt/src/vite/addServerConfig.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from 'fs';
22
import { createResolver } from '@nuxt/kit';
33
import type { Nuxt } from '@nuxt/schema';
4-
import { consoleSandbox } from '@sentry/utils';
4+
import { consoleSandbox, flatten } from '@sentry/utils';
55
import type { Nitro } from 'nitropack';
66
import type { InputPluginOption } from 'rollup';
77
import type { SentryNuxtModuleOptions } from '../common/types';
@@ -130,8 +130,9 @@ function wrapEntryWithDynamicImport(resolvedSentryConfigPath: string): InputPlug
130130

131131
moduleInfo.moduleSideEffects = true;
132132

133-
// The key `.` in `exportedBindings` refer to the exports within the file
134-
const exportedFunctions = moduleInfo.exportedBindings?.['.'];
133+
// `exportedBindings` can look like this: `{ '.': [ 'handler' ], './firebase-gen-1.mjs': [ 'server' ] }`
134+
// The key `.` refers to exports within the current file, while other keys show from where exports were imported first.
135+
const exportedFunctions = flatten(Object.values(moduleInfo.exportedBindings || {}));
135136

136137
// The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix
137138
return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)

0 commit comments

Comments
 (0)