File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
plugins/node/opentelemetry-instrumentation-koa/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,11 @@ export class KoaInstrumentation extends InstrumentationBase<typeof koa> {
5555 return new InstrumentationNodeModuleDefinition < typeof koa > (
5656 'koa' ,
5757 [ '^2.0.0' ] ,
58- moduleExports => {
58+ module => {
59+ const moduleExports =
60+ module [ Symbol . toStringTag ] === 'Module'
61+ ? module . default // ESM
62+ : module ; // CommonJS
5963 if ( moduleExports == null ) {
6064 return moduleExports ;
6165 }
@@ -68,9 +72,13 @@ export class KoaInstrumentation extends InstrumentationBase<typeof koa> {
6872 'use' ,
6973 this . _getKoaUsePatch . bind ( this )
7074 ) ;
71- return moduleExports ;
75+ return module ;
7276 } ,
73- moduleExports => {
77+ module => {
78+ const moduleExports =
79+ module [ Symbol . toStringTag ] === 'Module'
80+ ? module . default // ESM
81+ : module ; // CommonJS
7482 api . diag . debug ( 'Unpatching Koa' ) ;
7583 if ( isWrapped ( moduleExports . prototype . use ) ) {
7684 this . _unwrap ( moduleExports . prototype , 'use' ) ;
You can’t perform that action at this time.
0 commit comments