###The Problem
I recently published a package to npm and got an issue raised on Github to tell me that the build artifact hadn't been published.
The helpful person who raised the issue informed me that in the absence of an .npmignore file, npm will use your .gitignore file.
At the time, I had not wanted to push the build artifact to Github so I'd stuck the build directory into my .gitignore file. This meant that when I published the module to npm, it published everything but what I'd excluded from Github.
###The Solution
The work around for this is to create an empty .npmignore file, this means that npm will find this file and use it instead of your .gitignore file.
I couldn't believe that this was the correct intended functionality so I checked out the docs on npm and the documentation states exactly this.
###The Docs https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package
Use a
.npmignorefile to keep stuff out of your package. If there's no.npmignorefile, but there is a.gitignorefile, then npm will ignore the stuff matched by the.gitignorefile. If you want to include something that is excluded by your.gitignorefile, you can create an empty.npmignorefile to override it. Like git, npm looks for.npmignoreand.gitignorefiles in all subdirectories of your package, not only the root directory.
###The Lesson So I really should have RTFM, but this is just something I'd totally overlooked and didn't expect. I thought I'd share my lesson just incase anyone else comes across this issue.