duffman/tspath

Minor bug: Dependency name mistaken as a path

tomcatmwi opened this issue · 0 comments

There is a dependency named graphql in node_modules.
I also have a src/graphql folder in my project.
In this folder, I have a Typescript file that imports from the graphql dependency:

import { GraphQLError } from 'graphql';

This is mistaken as a path reference by tspath, and it gets transpiled as:

const graphql_1 = require("../graphql/index.js");

Of course, the line can be skipped with // tspath: skip-file but it would be nice if tspath recognized that this is a reference to a dependency, and not to a folder. It would be as simple as collecting node_modules subfolders and giving them precedence over folder names.