-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
throws an error if the extends resolves to a JS file #7
Comments
Is this a real issue you're encountering? It currently throws if not a valid JSON: get-tsconfig/tests/specs/extends.spec.ts Lines 22 to 34 in 58a696c
|
Yes - it throws if it's not valid JSON, but what I'm hoping for is that it prioritizes using the I'm running into this when using TypeScript automatically uses the A potential workaround for us is to use |
Gotcha. Do you mind opening a PR with a failing test case? |
Failing test created. BTW - the test framework throws an error but passes if the test JS doesn't compile. 😅 |
What does this mean? |
Hi!
This code looks for
require.resolve
result - and only if that's not found does it trypath.join(extendsPath, 'tsconfig.json')
.The problem is what if
require.resolve
resolves to anindex.js
file. Then we try using that instead ofpath.join(extendsPath, 'tsconfig.json')
.Then we try to read the JSON file. But it's JS not JSON, so we throw an error.
Example:
@company/tsconfig
package.json
:@company/tsconfig
tsconfig.json
{ // normal tsconfig.json }
To resolve this we should do the resolving closer to how TypeScript does it. In this case, it would never resolve a .JS file, only .json. Perhaps if the filename is not
.json
we then attemptpath.join(extendsPath, 'tsconfig.json')
.The text was updated successfully, but these errors were encountered: