-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Description
We can replace resolve with built-ins starting Node 8.9.0 and above.
It pulls in a bunch of deps, and doesn’t support exports field and custom conditions (which is very common in modern JS apps).
For CJS you can use require.resolve. ESM is more tricky, you prob need https://www.npmjs.com/package/resolve.exports, but there is import.meta.resolve that was introduced with Node 20.6.0
Here's an example PR I opened up with rollup that does the ESM thing: rollup/plugins#1742 (I may have to change this to make it work with ESM, need more testing)
Here's an example PR (that tbh should be merged in to require-in-the-middle) that does the CJS port: nodejs/require-in-the-middle#25
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels