File tree 2 files changed +9
-5
lines changed
packages/qwik/src/core/preloader
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ test('preloader script', () => {
21
21
* dereference objects etc, but that actually results in worse compression
22
22
*/
23
23
const compressed = compress ( Buffer . from ( preLoader ) , { mode : 1 , quality : 11 } ) ;
24
- expect ( compressed . length ) . toBe ( 1706 ) ;
25
- expect ( preLoader . length ) . toBe ( 5082 ) ;
24
+ expect ( compressed . length ) . toBe ( 1722 ) ;
25
+ expect ( preLoader . length ) . toBe ( 5107 ) ;
26
26
} ) ;
Original file line number Diff line number Diff line change @@ -179,12 +179,16 @@ export const adjustProbabilities = (
179
179
const prevAdjust = dep . $factor$ ;
180
180
/**
181
181
* The chance that a dep won't be loaded is 1-(the chance that the dep will be loaded)*(the
182
- * chance that the current bundle will be loaded)
182
+ * chance that the current bundle will be loaded).
183
183
*
184
184
* We can multiply this chance together with all other bundle adjustments to get the chance
185
- * that a dep will be loaded given all the chances of the other bundles
185
+ * that a dep will be loaded given all the chances of the other bundles.
186
+ *
187
+ * But when we're very likely to load the current bundle, make the dynamic imports more likely
188
+ * too.
186
189
*/
187
- const newInverseProbability = 1 - dep . $probability$ * probability ;
190
+ const newInverseProbability =
191
+ dep . $probability$ !== 1 && adjustFactor < 0.1 ? 0.05 : 1 - dep . $probability$ * probability ;
188
192
189
193
/** We need to undo the previous adjustment */
190
194
const factor = newInverseProbability / prevAdjust ;
You can’t perform that action at this time.
0 commit comments