Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (27 sloc) 867 Bytes
layout title date excerpt categories
Including files in npm publish
2017-09-23 20:36:38 -4000
How to include and exclude files during npm publish.
npm publish

npm looks at .gitignore to figure out what files/directories to blacklist when a package is being published to the registry.

But what if there are files/directories specified in .gitignore that you want to include in the publish?

# .gitignore

You can whitelist the directories (as well as any other files) in package.json:

  "files": [

Alternatively, you can create an empty .npmignore because it takes precedence over .gitignore:

$ touch .npmignore