This repository was archived by the owner on Sep 9, 2021. It is now read-only.
File tree 4 files changed +35
-0
lines changed
fixtures/inline-fallbacks
4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ const w1 = require ( './w1.js' ) ;
2
+ const w2 = require ( './w2.js' ) ;
Original file line number Diff line number Diff line change
1
+ // w1 inlined with fallback
Original file line number Diff line number Diff line change
1
+ // w2 inlined with fallback
Original file line number Diff line number Diff line change @@ -116,4 +116,35 @@ describe('worker-loader', () => {
116
116
assert . notEqual ( readFile ( bundleFile ) . indexOf ( '// w2 inlined via options' ) , - 1 ) ;
117
117
} )
118
118
) ;
119
+
120
+ it ( 'should add fallback chunks with inline option' , ( ) =>
121
+ makeBundle ( 'inline-fallbacks' , {
122
+ module : {
123
+ rules : [
124
+ {
125
+ test : / ( w 1 | w 2 ) \. j s $ / ,
126
+ loader : '../index.js' ,
127
+ options : {
128
+ inline : true ,
129
+ } ,
130
+ } ,
131
+ ] ,
132
+ } ,
133
+ } ) . then ( ( stats ) => {
134
+ const files = stats . toJson ( 'minimal' ) . children
135
+ . map ( item => item . chunks )
136
+ . reduce ( ( acc , item ) => acc . concat ( item ) , [ ] )
137
+ . map ( item => item . files )
138
+ . map ( item => `expected/inline-fallbacks/${ item } ` ) ;
139
+ assert . equal ( files . length , 2 ) ;
140
+ const w1 = readFile ( files [ 0 ] ) ;
141
+ const w2 = readFile ( files [ 1 ] ) ;
142
+ if ( w1 . indexOf ( '// w1 via worker options' ) !== - 1 ) {
143
+ assert . notEqual ( w2 . indexOf ( '// w2 via worker options' ) , - 1 ) ;
144
+ }
145
+ if ( w1 . indexOf ( '// w2 via worker options' ) !== - 1 ) {
146
+ assert . notEqual ( w2 . indexOf ( '// w1 via worker options' ) , - 1 ) ;
147
+ }
148
+ } )
149
+ ) ;
119
150
} ) ;
You can’t perform that action at this time.
0 commit comments