Make npm ignore folders starting by certain prefix

322 views Asked by At

Right now my .gitignore files has the following rule:

demos/test**

Which seems to be working fine with Git (and github) and ignoring the following folders:

./demos/test-whatever/
./demos/test/

But when publishing to npm, those folders are not ignored and are being published.

Any way to exclude them from npm?

3

There are 3 answers

2
Nathan On BEST ANSWER

Create a .npmignore file in your root directory and add your demos/test** ignore rule to this file. For reference:

.npmignore

   demos/test**
1
rileyjsumner On

Try a .npmignore file More info

2
TaoPaipai On

You may want .npmignore to keep files out of your package.