The npm community forum has been discontinued.
To discuss usage of npm, visit the GitHub Support Community.
docs implement for package.json#files
I’ve read the package.json docs. I found there is a conflicted expression about package.json#files and .npmignore. Compared the tow sentence below:
“At the root of your package it will not override the “files” field, but in subdirectories it will.” and " Files included with the “package.json#files” field cannot be excluded through
.gitignore ." package.json#files
From a certain point of view those are both correct. That said, documentation could be a lot clearer. (We love docs PRs!)
files overrides the top level
.gitignore… but if
files includes a directory name, we DO still process the
.gitignore inside that directory. It’s only the top level ones that are ignored.
Probably the best, most comprehensive answer to how things are included is here:
Which is based on this:
thank you. your answer help me a lot.