The exports field in package.json allows to define certain inner paths for package resolution, e.g.,
{
"package":"test",
"exports":{
".": "./index.js",
"./functions": "./lib/functions.js",
}
}
Should allow to:
require('test/functions')
Although this works in Node, this does not work in GraalJS. A separate issue is created for ESM module loader which bails on discovering exports altogether.