I've created npm package. In this package I'm using some modules which I put to node_modules to be able to require them as "modules", for example I have modules node_modules/my-module.js which I require in my code as require('my-module'). Now I do "npm publish" and then in another project I do "npm i" to install my module. It is installed but there are no my modules which I put to node_modules. I tried to add the next lines to .gitignore and to .npmignore, but it did not help:
node_modules/*
!node_modules/my-module.js
what do I do wrong?
I believe that all files in node_modules/
are ignored by NPM, so setting rules for node_modules
in .gitignore
and .npmignore
will have no effect.
Additionally, everything in node_modules is ignored, except for bundled dependencies. npm automatically handles this for you, so don't bother adding node_modules to .npmignore.
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With