Reputation: 819
I'm trying to publish package to npm but don't want that who using the package be able to see the code. How can I do this?
Upvotes: 2
Views: 1758
Reputation: 520
You can compile your code e.g. to dist
folder and then run npm publish
in the dist
directory. Users then can see only what will be placed in the dist folder (compiled code). However, I think that this is not good practice.
You can also consider private npm packages to distribute your packages only to those who you want.
Upvotes: 0
Reputation: 181460
Since npm
is pretty much used to distribute JavaScript+CSS files, there is nothing you can do about it. Your code is going to be seen by whoever uses it or executes it.
You might be able to mitigate this somehow by using minifiers or obfuscators though.
Upvotes: 1