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

fix: tsconfig resolution quirks #683

Merged
merged 1 commit into from Aug 26, 2022
Merged

fix: tsconfig resolution quirks #683

merged 1 commit into from Aug 26, 2022

Conversation

spence-s
Copy link
Contributor

closes #682

  • fixes an issue where a valid tsconfig with comments could potentially error
  • adds a failsafe for some quirky behavior around resolution for extends

Unfortunately tsconfig resolution is less straightforward that I thought, and apologies for the churn around this. Hopefully this change will now support the vast majority of ways people can use a tsconfig

I have played around with using TS directly for parsing the tsconfig it works, but the downsides are that it breaks a lot of tests, is a relatively big refactoring, and it is all sync methods.

basePath = require.resolve(path.join(tsConfig.extends, 'tsconfig.json'));
} catch {
// Throw the orginal resolution error to let the user know their extends block is invalid
throw error;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively we could just swallow this error, and when that happens we would just generate the needed tsconfig for the file. That may be the better way to handle this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should swallow errors like that. It sounds like a pain to debug that it's working, but with the incorrect config.

@sindresorhus sindresorhus merged commit 4cf8b05 into xojs:main Aug 26, 2022
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 this pull request may close these issues.

Error: Cannot find module '<tsconfig from node_modules>'
2 participants