@@ -362,10 +362,6 @@ function createWebpackConfig(
362362 // V8 chokes on very long sequences, work around that.
363363 sequences : false ,
364364 } ,
365- mangle : {
366- // Ensure that the `tweakWebpackOutput` function works.
367- reserved : [ "__webpack_exports__" ] ,
368- } ,
369365 keep_classnames : true ,
370366 keep_fnames : true ,
371367 module : isModule ,
@@ -463,13 +459,6 @@ function checkChromePreferencesFile(chromePrefsPath, webPrefs) {
463459 return ret ;
464460}
465461
466- function tweakWebpackOutput ( jsName ) {
467- return replace (
468- / ( (?: \s | , ) _ _ w e b p a c k _ e x p o r t s _ _ ) (?: \s ? ) = (?: \s ? ) ( { } ; ) / gm,
469- ( match , p1 , p2 ) => `${ p1 } = globalThis.${ jsName } = ${ p2 } `
470- ) ;
471- }
472-
473462function createMainBundle ( defines ) {
474463 const mainFileConfig = createWebpackConfig ( defines , {
475464 filename : defines . MINIFIED ? "pdf.min.mjs" : "pdf.mjs" ,
@@ -479,8 +468,7 @@ function createMainBundle(defines) {
479468 } ) ;
480469 return gulp
481470 . src ( "./src/pdf.js" , { encoding : false } )
482- . pipe ( webpack2Stream ( mainFileConfig ) )
483- . pipe ( tweakWebpackOutput ( "pdfjsLib" ) ) ;
471+ . pipe ( webpack2Stream ( mainFileConfig ) ) ;
484472}
485473
486474function createScriptingBundle ( defines , extraOptions = undefined ) {
@@ -548,8 +536,7 @@ function createSandboxBundle(defines, extraOptions = undefined) {
548536
549537 return gulp
550538 . src ( "./src/pdf.sandbox.js" , { encoding : false } )
551- . pipe ( webpack2Stream ( sandboxFileConfig ) )
552- . pipe ( tweakWebpackOutput ( "pdfjsSandbox" ) ) ;
539+ . pipe ( webpack2Stream ( sandboxFileConfig ) ) ;
553540}
554541
555542function createWorkerBundle ( defines ) {
@@ -561,8 +548,7 @@ function createWorkerBundle(defines) {
561548 } ) ;
562549 return gulp
563550 . src ( "./src/pdf.worker.js" , { encoding : false } )
564- . pipe ( webpack2Stream ( workerFileConfig ) )
565- . pipe ( tweakWebpackOutput ( "pdfjsWorker" ) ) ;
551+ . pipe ( webpack2Stream ( workerFileConfig ) ) ;
566552}
567553
568554function createWebBundle ( defines , options ) {
@@ -610,8 +596,7 @@ function createComponentsBundle(defines) {
610596 } ) ;
611597 return gulp
612598 . src ( "./web/pdf_viewer.component.js" , { encoding : false } )
613- . pipe ( webpack2Stream ( componentsFileConfig ) )
614- . pipe ( tweakWebpackOutput ( "pdfjsViewer" ) ) ;
599+ . pipe ( webpack2Stream ( componentsFileConfig ) ) ;
615600}
616601
617602function createImageDecodersBundle ( defines ) {
@@ -625,8 +610,7 @@ function createImageDecodersBundle(defines) {
625610 } ) ;
626611 return gulp
627612 . src ( "./src/pdf.image_decoders.js" , { encoding : false } )
628- . pipe ( webpack2Stream ( componentsFileConfig ) )
629- . pipe ( tweakWebpackOutput ( "pdfjsImageDecoders" ) ) ;
613+ . pipe ( webpack2Stream ( componentsFileConfig ) ) ;
630614}
631615
632616function createCMapBundle ( ) {
0 commit comments