This works pretty well unless one of your local modules depends on another local module. installing the linked modules in your target module(app) by running npm link in the target folder.declaring a module as a global link by running npm link in the module’s root folder.The 3rd working solution exists - npm linking! The linking process consists of two steps: And the second one requires re-installing modules each time when there are any changes to them. The first possible solution would require changing your code if modules get published. using local npm installs: npm install.using relative path to require a local module: var myModule = require('././local-folder/my-module').These requirements discard the following solutions: declaring dependencies in your app using the module name as if it was publishedĪdditionally, it’s good to be able to edit the modules’ code and see the changes in your app immediately without re-installation of modules.requiring modules by the module name in your code: var myModule = require('my-module').Nevertheless, you need to use them pretty much like any of the published node modules in order to ease the subsequent publishing. If you develop a modular application for Node.js, you may end up having lots of local node modules which you don’t want to publish yet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |