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
const path = require("path"); | |
function replacePathAlias(currentFilePath, importPath, pathMap) { | |
// if windows env, convert backslashes to "/" first | |
console.log(currentFilePath) | |
currentFilePath = path.posix.join(...currentFilePath.split(path.sep)); | |
const regex = createRegex(pathMap); | |
return importPath.replace(regex, replacer); |