Is the “files” property necessary in package.json?

You can think of the files property in package.json as an allowlist of all files that should be included in a npm release and .npmignore as a denylist of all files that should not be included.

As a rule of thumb, for my own projects I usually use:

  • files when my project has lots of auxiliary files like build scripts, config files, etc., that do not need to be included in a npm release
  • .npmignore when there are only a few such auxiliary files

Both options are useful in different scenarios in my mind.

Leave a Comment

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