-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Description
What is the problem this feature will solve?
Currently if you require(esm)
from a CJS module it will only load conditionals in esm package exports
: require
, node
, node-addons
, module-sync
. So if you e.g. const { delay } = require("unicorn-magic");
this will not work because exports
from that package are:
{
"node": {
"types": "./node.d.ts",
"import": "./node.js"
},
"default": {
"types": "./default.d.ts",
"import": "./default.js"
}
}
The package wasn't designed with require(esm)
in mind however it does work if you copy require
conditions to be the same as the import
conditions here.
What is the feature you are proposing to solve the problem?
For packages like the one in the example below could we also test import
branches as in many case the module will load fine.
What alternatives have you considered?
No response
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Type
Projects
Status
Awaiting Triage