How does npm publish ignore files?

when using npm to publish a package, there are some files under the current folder that you do not want to publish, such as the node_modules folder. You must install and rely on them when you test them. It is obviously not good to release these files as well.
do you have to put the files you need in another folder or delete files that don"t need to be published every time you publish?

is there any configuration to ignore some folders when publishing the package?
is like .gitignore in git.

Mar.04,2021

blacklist mode: .npmlists files, use .gitignore files without .npmlists.
whitelist mode: configure files field in package.json


https://cnodejs.org/topic/58b.

Menu