Created
October 21, 2018 23:37
-
-
Save arcanis/6859528aba1dfa180d5f6bc700510438 to your computer and use it in GitHub Desktop.
This file contains 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
resolveModuleNames: (moduleNames, containingFile) => { | |
try { | |
const pnpModuleNames = moduleNames.map(moduleName => { | |
const [, prefix, rest] = moduleName.match(/^((?:!.*!)?)(.*)/); | |
const unqualified = require('pnpapi').resolveToUnqualified(rest, containingFile); | |
return unqualified !== null ? prefix + unqualified : moduleName; | |
}); | |
const tsResolutions = resolveModuleNames(resolveSync, moduleResolutionHost, appendTsSuffixTo, appendTsxSuffixTo, scriptRegex, instance, pnpModuleNames, containingFile, getResolutionStrategy); | |
for (let t = 0; t < tsResolutions.length; ++t) | |
if (tsResolutions[t]) | |
tsResolutions[t].originalFileName = pnpModuleNames[t]; | |
return tsResolutions; | |
} catch (err) { | |
console.log(err.stack); | |
throw err; | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment