4 ms·
You can specify those exports in package.json. { "exports": "dist/index.js" } or { "exports": { ".": "dist/index.js", "./*": "dist/
by paulddraper 3y ago
You can specify those exports in package.json.
{
"exports": "dist/index.js"
}
or
{
"exports": {
".": "dist/index.js",
"./*": "dist/*.js"
}
}
https://nodejs.org/api/packages.html#subpath-exports https://nodejs.org/api/packages.html#subpath-exports
Many packages do this.
- rattray 3y agoNote that jest before v27, and some other runtimes, don't support export maps.
- paulddraper 3y agoJest and every other major runtime/bundler has supported exports for a couple years. I.e. if you're releasing a package today, you probably don't have to worry about support.
- rattray 3y agoA package I help maintain was released about a month ago, and we've had bug reports related to this: https://github.com/openai/openai-node/issues/304#issuecomment-1716133091 https://github.com/openai/openai-node/issues/304#issuecommen... We simply chose to mark Jest 27 as unsupported in this case, but it did cost some debugging time.
- paulddraper 3y agoEDIT: main and module properties are precursors to exports. exports is the recommended replacement.