Skip to content

Commit

Permalink
Simplify format check if webpack plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
filipsobol committed Oct 11, 2024
1 parent 5335e31 commit a0d27e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/sonda/src/bundlers/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ function getFormat( module: StatsModule ): ModuleFormat {
return 'unknown';
}

if ( module.moduleType === 'javascript/esm' ) {
return 'esm';
}

if ( Array.isArray( module.providedExports ) && module.providedExports.length > 0 ) {
/**
* Sometimes ESM modules have `moduleType` set as `javascript/auto`, so we
* also need to check if the module has exports to determine if it's ESM.
*/
if ( module.moduleType === 'javascript/esm' || !!module.providedExports?.length ) {
return 'esm';
}

Expand Down

0 comments on commit a0d27e2

Please sign in to comment.