简体   繁体   中英

How to deploy an app with a private node module

I have a private library module mylib and an app that uses the library myapp . When I deploy myapp , I have to include mylib in the node_modules folder so it gets uploaded as well. But each time I make changes to mylib , I have to go to myapp and run npm install ~/mypath/mylib , which takes so much time, is there a faster way of dealing with private modules?

I think you might use some of CI services. Eg http://jenkins-ci.org/ . And you'll be able to set up necessary operations to run on your server after every push to your working git branch (or after private module modification).

Can't you create a symlink in your application folder to your own lib?

I know this works:

  • Have a root folder (f.ex. "application")
  • Have a "lib" folder in the root folder
  • Have a filesystem link to your private library in that lib folder

The downside is, that you can't access your library without a path, you need to give the path like f.ex. "require('../lib/mylib/xy')", but maybe you find this worth it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM