Skip to content

Commit

Permalink
Only resolve root import paths rather than all
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-oakes authored Feb 22, 2018
1 parent 30ed161 commit 7be9b6f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@ exports.resolve = (source, file, config = {}, babelrc = '.babelrc') => {

if (hasRootPathPrefixInString(source, prefix)) {
transformedSource = transformRelativeToRootPath(source, suffix, prefix);
// Since babel-plugin-root-import 5.0.0 relative path is now actually relative to the root.
// Node resolver expects that path would be relative to file, so we have to resolve it first
transformedSource = path.resolve(transformedSource);
break;
}
}

// Since babel-plugin-root-import 5.0.0 relative path is now actually relative to the root.
// Node resolver expects that path would be relative to file, so we have to resolve it first
transformedSource = path.resolve(transformedSource);

return nodeResolve(transformedSource, file, {});
};

0 comments on commit 7be9b6f

Please sign in to comment.