I have made a JS library for web development, it consists of several modules, which build up multiple distribution builds. It's fine when it is distributed over cdn or for example using Bower.
But now I'm trying to publish it with NPM so that it can be consumed using Browserify. My question is how can I expose more than one main file statically so that they can be consumable by Browserify.
json file, but there is nothing inherently wrong with multiple package. json files within a repo. Some companies do use mono-repos, for which it would make total sense to have multiple package. json files.
Installing multiple packages using package. When you run the npm install command without specifying any package name, then npm will look for an existing package. json file in the current working directory. npm will install all packages listed as dependencies of the project.
If you find malware in an npm package (either yours or someone else's), you can report it to the npm Security team to help keep the Javascript ecosystem safe. Note: Vulnerabilities in npm packages should be reported directly to the package maintainers. We strongly advise doing this privately.
Running npm install twice creates wrong package-lock.
you don't need to do anything.
require('my-library') // will require the `main` entry point
require('my-library/some-other-file') // will require a different file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With