0

Here is what I have in node_modules when I install my package:

enter image description here

Even though I am using this files field in package.json:

"files": [
    "./dist"
  ]

Why is that?

double-beep
  • 5,031
  • 17
  • 33
  • 41
raury
  • 85
  • 1
  • 7

3 Answers3

2

Maybe you misunderstood what the files field does:

The optional files field is an array of file patterns that describes the entries to be included when your package is installed as a dependency

The files field is used to define files that should be imported alongside your library when another project install your project as a npm package.

Mário Garcia
  • 553
  • 3
  • 13
  • 1
    Exactly. I created a package and now testing its locally as written on [npm](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages#testing-your-package) and when i open my installed package inside node_modules it has all sourse files instead of heaving only **dist**, **license** and **readme** despite i have **files** field in package.json – raury Jan 24 '21 at 09:46
0

Thats how module works.if you don't like node_modules folder try Yarn2 . Same thing.but different module folder name.

masterbrian99
  • 15
  • 1
  • 6