Search code examples
node.jsgitnpmgit-submodules

npm install update git submodule


I have a Node JS lib with git submodule. When I clone the git repository of my lib, I had to do submodule update --init --recursive something like this to pull the actual stuff from the submodule. After I released the lib and I did npm install my-lib and noticed it's not pulling the git submodule. How do I configure it so it pulls the git submodule? is that even possible?


Solution

  • I don't think that is possible, as the submodule is, outside of git, just a simple file.

    What you can do, however, is using the submodule only in development, compile your library and publish the compiled version in a dist/ folder inside the package.

    Then just point main in the package.json to the compiled library script and you can include it in your other projects.