Avoid using relative paths on require()

前端 未结 2 1771
情话喂你
情话喂你 2021-01-26 06:57

I\'m new with NodeJs, my project is growing and i dont want make relative imports, i want imports like these installed from npm.

I have the following directory structure

2条回答
  •  北海茫月
    2021-01-26 07:33

    There is nothing which says you cannot put your own code inside node_modules. This will enable you to reference it as you want. If you have a .gitignore or equivalent preventing code inside node_modules from being committed, you can add exceptions for your own code.

    node_modules
    !node_modules/model/
    

提交回复
热议问题