Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tsconfig.json to resolveImportPath.js #114

Open
mgs95 opened this issue Jul 2, 2020 · 1 comment · May be fixed by #115
Open

Add tsconfig.json to resolveImportPath.js #114

mgs95 opened this issue Jul 2, 2020 · 1 comment · May be fixed by #115

Comments

@mgs95
Copy link

mgs95 commented Jul 2, 2020

Typescript users use a tsconfig.json file instead of a jsconfig.json file. Both contain the include field which is used to get the absolute path.

Inside resolveImportPath.js there should be something like this:

var jsconfigPath = path.resolve(CMD, 'jsconfig.json');
var tsconfigPath = path.resolve(CMD, 'tsconfig.json');
var jsconfigInclude;

if (fs.existsSync(jsconfigPath) || fs.existsSync(tsconfigPath)) {
  var config = fs.readFileSync(jsconfigPath, 'utf8') || fs.readFileSync(tsconfigPath, 'utf8');
  var jsconfig = JSON.parse(config);
  jsconfigInclude = jsconfig.include ? jsconfig.include[0] : null;
}

With this fix, issues regarding absolute paths should be resolved.

@angelsanchez
Copy link

I have the same problem.

Thanks for the solution @mgs95

@mgs95 mgs95 linked a pull request Jul 2, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants