@@ -18,7 +18,14 @@ describe('WebPack', () => {
1818 webpack (
1919 {
2020 entry : {
21- app : './src/app.mjs'
21+ app : {
22+ import : './src/app.mjs' ,
23+ // see https://github.com/CoderLine/alphaTab/issues/2299
24+ library : {
25+ type : 'assign' ,
26+ name : 'alphaTabApp'
27+ }
28+ }
2229 } ,
2330 output : {
2431 filename : '[name]-[contenthash:8].js' ,
@@ -99,16 +106,26 @@ describe('WebPack', () => {
99106 expect ( text ) . to . include ( '/* worklet bootstrap */ async function(__webpack_worklet__) {' ) ;
100107 // without custom bundling the app will bundle alphatab directly
101108 expect ( text ) . to . include ( 'class AlphaTabApiBase' ) ;
109+ // ensure the library mode is active as needed
110+ expect ( text ) . to . include ( 'alphaTabApp = __webpack_exports__' ) ;
102111
103112 appValidated = true ;
104113 } else if ( file . name . endsWith ( '.js' ) ) {
105114 if ( text . includes ( 'class AlphaTabApiBase' ) ) {
115+ // ensure the library mode is does not affect chunks
116+ expect ( text ) . to . not . include ( 'alphaTabApp = __webpack_exports__' ) ;
106117 coreFileValidated = true ; // found core file (imported by worker and worklet)
107118 } else if ( text . includes ( 'initializeAudioWorklet()' ) ) {
119+ // ensure the library mode is does not affect chunks
120+ expect ( text ) . to . not . include ( 'alphaTabApp = __webpack_exports__' ) ;
121+
108122 // ensure chunk installer is there
109123 expect ( text ) . to . include ( 'webpack/runtime/alphaTab audio worker chunk loading' ) ;
110124 workletValidated = true ;
111125 } else if ( text . includes ( 'initializeWorker()' ) ) {
126+ // ensure the library mode is does not affect chunks
127+ expect ( text ) . to . not . include ( 'alphaTabApp = __webpack_exports__' ) ;
128+
112129 // ensure chunk loader is there
113130 expect ( text ) . to . include ( 'webpack/runtime/importScripts chunk loading' ) ;
114131 workerValidated = true ;
0 commit comments