ESLint import resolver for ESM modules via package.json exports map.
Relies on NPM package resolve.exports https://github.com/lukeed/resolve.exports
See:
- import-js/eslint-plugin-import#1868
- import-js/eslint-plugin-import#1810
- browserify/resolve#224
- wooorm/import-meta-resolve#2
- eslint-community/eslint-plugin-n#4
- mysticatea/eslint-plugin-node#255
- mysticatea/eslint-plugin-node#244
- mysticatea/eslint-plugin-node#258
- https://github.com/webpack/enhanced-resolve
Ok, so I ran some additional tests.
Both "my" and "your"
builtinModulessolutions work (I tested them one by one, and I added an import typo likefssinstead offsto check false negatives / positives), ... however note in my case I have the following ESLint config:...the important part is the
import/resolver>typescriptobject, which when commented-out triggers either of ourbuiltinModulesconditionals (for example, forimport { readFileSync } from "fs"). However if I leave mytypescriptsettings in, then thebuiltinModulesconditionals are never reached, as NodeJS module imports such asfsseem to be captured appropriately somewhere else in the ESLint resolver chain, outside of my custom resolver.