From 6e83a6b3751b1d0f3859f536252603a0e462a607 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 11 Aug 2023 16:37:50 +0200 Subject: [PATCH] fix(nextjs): Only re-export default export if it exists (#8800) --- .../src/config/templates/sentryInitWrapperTemplate.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts b/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts index 1720c3b62672..ab38854f090f 100644 --- a/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts +++ b/packages/nextjs/src/config/templates/sentryInitWrapperTemplate.ts @@ -4,8 +4,14 @@ import '__SENTRY_CONFIG_IMPORT_PATH__'; // @ts-ignore This is the file we're wrapping // eslint-disable-next-line import/no-unresolved -export * from '__SENTRY_WRAPPING_TARGET_FILE__'; +import * as wrappee from '__SENTRY_WRAPPING_TARGET_FILE__'; + +// @ts-ignore default either exists, or it doesn't - we don't care +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +const defaultExport = wrappee.default; // @ts-ignore This is the file we're wrapping // eslint-disable-next-line import/no-unresolved -export { default } from '__SENTRY_WRAPPING_TARGET_FILE__'; +export * from '__SENTRY_WRAPPING_TARGET_FILE__'; + +export default defaultExport;