Skip to content

Instantly share code, notes, and snippets.

@arcanis arcanis/foo.js
Created Oct 21, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.