[英]How does project with nested node_modules behave?
We are trying to separate our project into "sub modules" within single repo, but keep things like webpack, express server global, so assume structure like this 我们正在尝试将我们的项目分成单个仓库中的“子模块”,但要保持webpack,express server等全局性,因此采用这样的结构
package.json
server.js
index.js
node_modules/
public/
index.html
dashboard.js
onboarding.js
dashboard/
index.js
package.json
node_modules/
components/
assets/
onboarding/
index.js
package.json
node_modules/
...
idea here is to keep build / routing / server logic at root lvl and separate modules like dashboard
and onboarding
into their separate folders and allow them to use their own node modules. 这里的想法是将构建/路由/服务器逻辑保留在根lvl处,并将单独的模块(如
dashboard
和onboarding
保留在各自的文件夹中,并允许他们使用自己的节点模块。
Will this work? 这样行吗? Will node modules be included correctly?
是否正确包含节点模块?
webpack will build assets to public/
folder, with some vendor assets and several entry points ie all index.js
files webpack会将资产构建到
public/
文件夹,其中包含一些供应商资产和几个入口点,即所有index.js
文件
What you are proposing will work fine and compile as you expect. 您提出的建议可以正常工作,并且可以按预期进行编译。 NodeJS will initially look for modules included in your modules 'node_modules' sub-directory and then work up the ladder.
首先,NodeJS将寻找模块“ node_modules”子目录中包含的模块,然后逐步完善。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.