javascript - webpack 配置
問題描述
大家看一下,我配置的入口文件里面有page/common/index.js.
這個(gè)index.js里面僅僅require了下面的 layout.css.并沒有require同級(jí)目錄nav下面的任何文件。
然后,在nav.js里面,我console.log(’你他媽是怎么找到我的?’). 在我一般的做法當(dāng)中,我肯定會(huì)在index.js里面require。這里并沒有。可是在隨后打包生成的index.js里面。剛剛console的話被打包成功了。感覺不合邏輯...

希望有經(jīng)驗(yàn)的大神不吝賜教...
繼續(xù)修改。
我把nav下面的index.js 改名為 nav.js我在入口文件 common/index.js里面require(’./nav/nav.js’)應(yīng)該是可以require到的吧。重新運(yùn)行webpack之后,會(huì)報(bào)錯(cuò):
Module not found: Error: Cannot resolve ’file’ or ’directory’ D:myItemhappy-p1/src/page/common/nav/index.js in D:myItemhappy-p1srcpageindex @ ./src/page/index/index.js 18:0-35
繼續(xù)求大神賜教...源代碼 http://pan.baidu.com/s/1c27vvR6
問題解答
回答1:Module not found: Error: Cannot resolve ’file’ or ’directory’ D:myItemhappy-p1/src/page/common/nav/index.js in D:myItemhappy-p1srcpageindex@ ./src/page/index/index.js 18:0-35
同志你在 D:myItemhappy-p1srcpageindex 干了什么見不得光的事...[doge]
回答2:目測(cè)是個(gè)低級(jí)錯(cuò)誤,你再找找吧
回答3:你檢查一下你三個(gè)入口文件里面的,肯定引入才會(huì)輸出的
相關(guān)文章:
1. javascript - sublime快鍵鍵問題2. javascript - immutable配合react提升性能?3. Apache 已經(jīng)把網(wǎng)站根目錄的改為allow from all了,但是服務(wù)器還是不能訪問?4. css - 寫頁(yè)面遇到個(gè)布局問題,求大佬們幫解答,在線等,急!~5. javascript - 移動(dòng)端上不能實(shí)現(xiàn)拖拽布局嗎?6. phpstudy8.1支持win11系統(tǒng)嗎?7. 配置Apache時(shí),添加對(duì)PHP的支持時(shí)語(yǔ)法錯(cuò)誤8. vue.js - Vue 如何像Angular.js watch 一樣監(jiān)聽數(shù)據(jù)變化9. javascript - nodejs關(guān)于進(jìn)程間發(fā)送句柄的一點(diǎn)疑問10. 實(shí)現(xiàn)bing搜索工具urlAPI提交

網(wǎng)公網(wǎng)安備