Entry in .npmignore doesn't work

1k views Asked by At

I'd like to keep source (/ts/**/*.ts) files only in remote git repo, and transpilation results (/js/**/*.js) - only in resulting npm package.
In order to achieve that I've added these entries in ignore-files:

.gitignore

/js
...

.npmignore

/ts

Remote repository doesn't contain /js folder, so .gitignore works fine.
But it looks like entry in .npmignore doesn't work, because I get /ts folder with its contents on npm i <package>.

What am I doing wrong?

1

There are 1 answers

1
Parzh from Ukraine On BEST ANSWER

Although I still didn't get the point of the issue, some of these helped:

  • re-clone the repo from scratch into another folder
  • run npm doctor
  • change entry in .npmignore to ./ts

So now the /ts folder is not being downloaded on npm i <package> and no fatal error occur.