My question concerns an existing library that I wish to publish as an NPM module. The library is already in use, and currently require
d via the local file syste
As the doc says:
The main field is a module ID that is the primary entry point to your program.
So you'll have something like "main": "src/js/lib/my/app.js"
in your package.json file.
I would suggest you to create an app.js
file and module.exports
your different children. For example:
module.exports.thing = require('./thing');
module.exports.that = require('./that');
And use them like this:
var mylib = require('mylib')
, thing = mylib.thing
, that = mylib.that;