Skip to content

Instantly share code, notes, and snippets.

@abha57
Last active January 10, 2022 11:39
Show Gist options
  • Select an option

  • Save abha57/3b2995c19386dd3b73bfd5e142b3e156 to your computer and use it in GitHub Desktop.

Select an option

Save abha57/3b2995c19386dd3b73bfd5e142b3e156 to your computer and use it in GitHub Desktop.
.npmrc and .npmignore files
.npmignore
Blacklisting files with npmignore
The .npmignore file works the same way as a .gitignore file.
If a file is listed in the .npmignore file, the file will be excluded from the package.
Important note: If you have a .npmignore file, npm will use the .npmignore file. npm will ignore the .gitignore file altogether.
(Many developers mistakenly believe npm will use both .npmignore and .gitignore files. Don’t make the same mistake!).
.npmrc
This file is a configuration file for NPM, it defines the settings on how NPM should behave when running commands.
There are several ways to configure NPM. You can do it via:
The command line by passing a setting with the NPM command you want to run.
Through ENV variables
And through..guess what.. npmrc
for eg - https://thabo-ambrose.medium.com/what-is-the-npmrc-file-for-d19fe6d69c9a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment