npm publish isn’t including all my files

The problem was I had a files array in package.json. If files is present, then only the specified files get published, and everything else is effectively npmignored.

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#files

Additionally: be aware that when there is no .npmignore file and the files array is empty the .gitignore file will be used. From the docs:

You can also provide a .npmignore file in the root of your package or in subdirectories, which will keep files from being included. At the root of your package it will not override the “files” field, but in subdirectories it will. The .npmignore file works just like a .gitignore. If there is a .gitignore file, and .npmignore is missing, .gitignore’s contents will be used instead.

Since .gitignore probably ignores your dist folder, this may be causing problems.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)