Kafin mu nutse cikin ษarna na kuskuren 'run dev mix' wanda ฦwararru da yawa a fagen shirye-shiryen JavaScript suka haษu, yana da mahimmanci mu fahimci menene 'mix'. Laravel Mix shine API ษin da ya dace don ayyana matakan gina fakitin Yanar Gizo don aikace-aikacen JavaScript ษinku ta amfani da CSS gama-gari da na'urori masu sarrafawa da yawa na JavaScript. Koyaya, masu amfani na iya yin tuntuษe akan saฦon kuskuren "run dev mix ba a samo ba", wanda zai iya zama mai ruษani sosai, musamman ga masu farawa.
Yanzu, bari mu yi rangadi tare ta hanyar hanyar magance wannan batu, da kuma manufar da ke tattare da lambar da za mu yi amfani da ita don magance ta.
Maganin 'run dev mix ba a samo ba'
Shahararriyar mafita don magance wannan matsalar ita ce tabbatar da cewa an shigar da duk abin dogaro daidai. Kuna iya yin hakan ta hanyar gudanar da umarni
npm install
. Wannan umarnin yana shigar da fakiti, da kowane fakitin da ya dogara da su. Duk da haka, idan matsalar ta ci gaba da ci gaba bayan gudanar da wannan umarni, yana nufin cewa matsalar ba ta kasance tare da shigarwar dogara ba.
Wata hanyar magance wannan ita ce tabbatar da cewa an siffanta rubutun da kyau a cikin fayil ษin 'package.json' ษinku. Ga yadda ya kamata ya kasance:
"scripts": { "dev": "npm run development", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "npm run development -- --watch", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }
Zurfafa Zurfafa cikin Code
Bari mu karya abin da ke faruwa a cikin wannan lambar. The "rubutun" abu wani ษangare ne na fayil ษin 'package.json' wanda ke ba ku damar laฦabi dogayen umarni tare da gajeru. A cikin yanayinmu, muna amfani da "dev" Rubutun don aiwatar da umarnin "npm run development". Muna kuma yin amfani da "cross-env" don saita masu canjin yanayi a cikin dandamali.
Binciko Laburaren Labarai masu alaฦa: Fakitin Yanar Gizo da Haษin Laravel
- Shafin yanar gizo: Wannan mai amfani shine madaidaicin tsarin bundler don aikace-aikacen JavaScript na zamani. Yana gina jadawali na dogaro wanda ke tsara kowane tsarin aikin da kuke buฦata kuma yana haifar da dauri ษaya ko fiye.
- Laravel Mix: Wannan kayan aiki ne mai taimako wanda ke baiwa masu haษakawa damar ayyana matakan gina fakitin Yanar Gizo don aikace-aikacen JavaScript ษin su ta hanyar da ta dace.
Yanzu, yakamata ku iya gudanar da umarnin 'npm run dev' ba tare da cin karo da saฦon kuskuren "run dev mix ba". Abu ne mai gamsarwa koyaushe ganin aikace-aikacenmu suna gudana ba tare da wata matsala ba, kuma ina fata wannan cikakkiyar bayani ya taimaka muku cimma hakan.