Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ export function constructWebpackConfigFunction({

// Orchestrion code-transform loader — Node server runtime only, never the edge compilation
if (runtime === 'server' && userSentryOptions._experimental?.useDiagnosticsChannelInjection) {
newConfig.plugins.push(sentryOrchestrionWebpackPlugin() as WebpackPluginInstance);
newConfig.plugins.push(sentryOrchestrionWebpackPlugin() as unknown as WebpackPluginInstance);
Comment thread
timfish marked this conversation as resolved.
}

return newConfig;
Expand Down
5 changes: 2 additions & 3 deletions packages/server-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@
},
"./orchestrion/vite": {
"types": "./build/types/orchestrion/bundler/vite.d.ts",
"import": "./build/esm/orchestrion/bundler/vite.js"
"default": "./build/esm/orchestrion/bundler/vite.js"
},
"./orchestrion/webpack": {
"types": "./build/types/orchestrion/bundler/webpack.d.ts",
"import": "./build/esm/orchestrion/bundler/webpack.js",
"require": "./build/cjs/orchestrion/bundler/webpack.js"
Comment thread
timfish marked this conversation as resolved.
"default": "./build/esm/orchestrion/bundler/webpack.js"
},
Comment thread
timfish marked this conversation as resolved.
"./orchestrion/import-hook": {
"import": "./build/orchestrion/import-hook.mjs"
Expand Down
9 changes: 3 additions & 6 deletions packages/server-utils/src/orchestrion/bundler/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { createRequire } from 'node:module';
import { dirname } from 'node:path';
import type { InstrumentationConfig } from '@apm-js-collab/code-transformer';
import { SENTRY_INSTRUMENTATIONS } from '../config';
import codeTransformer from '@apm-js-collab/code-transformer-bundler-plugins/webpack';

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