By default NPM will include all files as part of your package. But how can you exclude certain files?
To support that scenario NPM has the concept of a .npmignore file similar to a .gitignore file(Note: in case there is no .npmignore file, but there is a .gitignore file, nom will ignore the files matched by the .gitignore file).
.npmignore
files follow the same pattern rules as .gitignore
files.
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
.
The following paths and files are never ignored, so adding them to .npmignore
is pointless:
package.json
README
(and its variants)CHANGELOG
(and its variants)LICENSE
/LICENCE