Skip to content

Commit 5d05f56

Browse files
committed
fix(nextjs): Fix ESM interop. and remove lazy loading
1 parent 8c6358a commit 5d05f56

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

dev-packages/rollup-utils/npmHelpers.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function makeBaseNPMConfig(options = {}) {
9494
// (We don't need it, so why waste the bytes?)
9595
freeze: false,
9696

97-
interop: 'esModule',
97+
interop: 'auto',
9898
},
9999

100100
treeshake: {

packages/nextjs/src/config/webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ export function constructWebpackConfigFunction({
433433

434434
// Orchestrion code-transform loader — Node server runtime only, never the edge compilation
435435
if (runtime === 'server' && userSentryOptions._experimental?.useDiagnosticsChannelInjection) {
436-
newConfig.plugins.push(sentryOrchestrionWebpackPlugin() as WebpackPluginInstance);
436+
newConfig.plugins.push(sentryOrchestrionWebpackPlugin() as unknown as WebpackPluginInstance);
437437
}
438438

439439
return newConfig;

packages/server-utils/src/orchestrion/bundler/webpack.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { createRequire } from 'node:module';
55
import { dirname } from 'node:path';
66
import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';
77
import { SENTRY_INSTRUMENTATIONS } from '../config';
8+
import codeTransformer from '@apm-js-collab/code-transformer-bundler-plugins/webpack';
89

910
// Both branches use `createRequire` (never alias the CJS `require`) so bundlers consuming this
1011
// module don't emit a "Critical dependency" warning.
@@ -46,10 +47,6 @@ export function getSentryInstrumentations(): InstrumentationConfig[] {
4647
* does NOT inject the `__SENTRY_ORCHESTRION__.bundler` marker — that would disable the runtime
4748
* module hook, which externalized packages still need (hybrid setup).
4849
*/
49-
export function sentryOrchestrionWebpackPlugin(): unknown {
50-
const mod = getOrchestrionRequire()('@apm-js-collab/code-transformer-bundler-plugins/webpack') as {
51-
default?: (options: { instrumentations: InstrumentationConfig[] }) => unknown;
52-
};
53-
const codeTransformerWebpack = mod.default ?? (mod as unknown as NonNullable<typeof mod.default>);
54-
return codeTransformerWebpack({ instrumentations: SENTRY_INSTRUMENTATIONS });
50+
export function sentryOrchestrionWebpackPlugin(): ReturnType<typeof codeTransformer> {
51+
return codeTransformer({ instrumentations: SENTRY_INSTRUMENTATIONS });
5552
}

0 commit comments

Comments
 (0)