Skip to content

Commit c7378e6

Browse files
authored
fix(nuxt): Re-export all exported bindings (#14086)
This was brought up here: #14064 Only the "root bindings" were exported, which led to not re-exported functions that were imported from another file before they were exported (like firebase `server`).
1 parent 22c3865 commit c7378e6

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';
@@ -129,8 +129,9 @@ function wrapEntryWithDynamicImport(resolvedSentryConfigPath: string): InputPlug
129129

130130
moduleInfo.moduleSideEffects = true;
131131

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

135136
// 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
136137
return resolution.id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)

0 commit comments

Comments
 (0)