Bundle એ JavaScript છે જે તમારું build tool package કરી browser ને મોકલે છે. તે મુખ્યત્વે dependency, duplicated code, અને page ને હજુ જરૂરી ન હોય તેવો code મોકલવા થી વધે છે.
Bundle એ JavaScript છે જે તમારું build tool package કરી browser ને મોકલે છે. તે મુખ્યત્વે dependency, duplicated code, અને page ને હજુ જરૂરી ન હોય તેવો code મોકલવા થી વધે છે.
lodash import કરવાથી આખી વસ્તુ ખેંચાઈ આવે છે.import _ from "lodash"; // ~70KB — the entire library
import debounce from "lodash/debounce"; // ~2KB — just the function you need
Byte એ નાની સમસ્યા છે; JS ને parse અને execute કરવું એ મોટી છે. Browser ને દરેક byte download, પછી parse, compile, અને main thread પર run કરવો પડે છે — અને તે laptop કરતાં mid-range phone પર ઘણું ધીમું છે. ભારે JS interactivity ને વિલંબિત કરે છે અને INP તથા LCP ને સીધું બગાડે છે.
"બસ library ઉમેરી દો" એ રીતે app ચૂપચાપ ધીમા બને છે. Interviewer જોવા માંગે છે કે તમે dependency દીઠ ખર્ચ વિશે વિચારો છો અને bundle ફૂલી જાય તે પહેલાં per-function import, tree shaking, અને code splitting તરફ વળો છો — ખાસ કરીને કારણ કે તમારા user ના phone તમારા dev machine કરતાં ઘણા નબળા છે.
વિગતવાર જવાબો સાથે IT ઇન્ટરવ્યૂ પ્રશ્નોની લાઇબ્રેરી — જુનિયરથી સિનિયર સુધી.
દાન કરો