File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
packages/qwik/src/core/preloader Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ test('preloader script', () => {
2121 * dereference objects etc, but that actually results in worse compression
2222 */
2323 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 ) ;
2626} ) ;
Original file line number Diff line number Diff line change @@ -179,12 +179,16 @@ export const adjustProbabilities = (
179179 const prevAdjust = dep . $factor$ ;
180180 /**
181181 * 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).
183183 *
184184 * 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.
186189 */
187- const newInverseProbability = 1 - dep . $probability$ * probability ;
190+ const newInverseProbability =
191+ dep . $probability$ !== 1 && adjustFactor < 0.1 ? 0.05 : 1 - dep . $probability$ * probability ;
188192
189193 /** We need to undo the previous adjustment */
190194 const factor = newInverseProbability / prevAdjust ;
You can’t perform that action at this time.
0 commit comments