I have a repo which contains a collection of a few Node.js serverless, Function-as-a-Service functions. The functions share the same node_modules
directory, but deployed separately to our FaaS platform.
npm init
creates a "main": "function.js"
entry in package.json
. Since I don't have a single (or any) entry point, I wonder if I can remove this line altogether.
Is the main
key in package.json
mandatory?
No, it's not mandatory.
You can publish a package on npm (using the npm publish
command) even without specifying a main entry point. So you're free to remove it from your package.json.
According to the docs, the only required fields are "name" and "version".
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