How To Require Module of a Node Submodule

后端 未结 2 606
迷失自我
迷失自我 2021-01-12 02:07

Lets say the module X has a Y submodule. From my node app that has a dependency on X, how can I require submodule Y?

var Y = require(\'X:Y\'); results

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-12 02:42

    Submodule meaning an export from within the X module?

    Try...

    require('X/path-to-Y')
    

提交回复
热议问题