javascript - webpack configuration
过去多啦不再A梦
过去多啦不再A梦 2017-06-30 09:59:21
0
3
642

Take a look, the entry file I configured contains page/common/index.js.

  1. In this index.js, only requires the following layout.css. It does not require any files under the nav directory of the same level.

  2. Then, in nav.js, I console.log('How the hell did you find me?').
    In my general approach, I will definitely do it in index.js require. Not here. But in the index.js that is subsequently packaged and generated. The console just said it was packaged successfully. It feels illogical...

I hope experienced masters will give me some advice...



Continue to modify.

I renamed index.js under nav to nav.js
I require('./nav) in the entry file common/index.js /nav.js') should be required. After re-running webpack, an error will be reported:

Module not found: Error: Cannot resolve 'file' or 'directory' D:\myItem\happy-p1
/src/page/common/nav/index.js in D:\myItem\happy-p1\src\page\index
 @ ./src/page/index/index.js 18:0-35

Continue to ask God for enlightenment...
Source code http://pan.baidu.com/s/1c27vvR6

过去多啦不再A梦
过去多啦不再A梦

reply all(3)
伊谢尔伦
Module not found: Error: Cannot resolve 'file' or 'directory' D:\myItem\happy-p1
/src/page/common/nav/index.js in D:\myItem\happy-p1\src\page\index
@ ./src/page/index/index.js 18:0-35

Comrade, what are you doing in D:myItemhappy-p1srcpageindex? [doge]

学霸

Visual inspection is a simple mistake, please look for it again

学霸

Check your three entry files, they must be imported before they are output

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template