Webpack Yanayin agogon fasalin fasalin ne wanda ke ba da damar kayan aiki don saka idanu fayilolin tushen ku don canje-canje kuma yana haifar da sakewa ta atomatik duk lokacin da aka gano canji. Wannan yana da amfani musamman yayin haɓakawa, saboda yana taimaka muku adana lokaci ta hanyar guje wa haɗawa da hannu duk lokacin da kuka yi canje-canje ga lambar ku.
Ga yadda zaku iya amfani da Webpack yanayin agogo:
Ana Gudu Webpack a Yanayin Kallo
Don aiki Webpack a yanayin agogo, zaku iya amfani da --watch
tuta lokacin gudanar da webpack umarni ta tashar ku. Misali:
npx webpack --watch
Tare da wannan umarni, Webpack zai fara kallon fayilolin tushen ku kuma za a sake tattara tarin ta atomatik a duk lokacin da kuka ajiye canje-canje gare su.
Webpack Kanfigareshan
Hakanan zaka iya saita yanayin agogo a cikin webpack fayil ɗin sanyi( webpack.config.js
) ta ƙara watch: true
zaɓi:
module.exports = {
// ...other configuration options
watch: true
};
Ta wannan hanyar, ba kwa buƙatar amfani da --watch
tuta duk lokacin da kuke gudanar da webpack
umarni.
Hali
Lokacin Webpack yana cikin yanayin agogo, zai ci gaba da saka idanu fayilolin tushen ku don canje-canje. Duk lokacin da kuka yi canje-canje kuma ku adana fayilolin, Webpack za su sake tattara tarin ta atomatik. Wannan yana ba ku damar ganin canje-canje a cikin aikace-aikacenku ba tare da kunna aikin ginin da hannu kowane lokaci ba.
Ka tuna cewa yayin da yanayin agogo yana da kyau don haɓakawa, ba a saba amfani da shi a cikin ginin samarwa ba, saboda yana iya cinye albarkatun da ba dole ba. Don haɓaka samarwa, gabaɗaya za ku yi amfani da su Webpack don ƙirƙirar ingantattun daɗaɗɗen dam ba tare da yanayin agogo ba.
Tuna don komawa zuwa Webpack takaddun hukuma don mafi sabunta bayanai kan amfani da yanayin agogo da zaɓuɓɓukan haɗin sa.