Created
January 13, 2022 17:29
-
-
Save DanielHoffmann/e9737f46cc7421ac5c227d583cd59f1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// used so eslint-plugin-import can properly resolve dependencies using yarn2 | |
let pnp | |
try { | |
pnp = require(`./.pnp.cjs`) | |
} catch (error) { | |
// not a problem | |
} | |
const NOTFOUND = { found: false } | |
module.exports = { | |
interfaceVersion: 2, | |
resolve: (source, file) => { | |
if (!pnp) { | |
throw new Error(`This resolver is meant to be used with pnp, but no pnp file was found`) | |
} | |
try { | |
return { found: true, path: pnp.resolveRequest(source, file) } | |
} catch (error) { | |
return NOTFOUND | |
} | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment