-
Notifications
You must be signed in to change notification settings - Fork 106
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
Extension configuration should override, not deep merge #94
Comments
If we're not following the behaviour of |
* yarn-deduplicate && yarn * Make extension config override instead of deep merge Fixes #94
@OliverJAsh this change is causing microsoft/TypeScript#20110 (comment) issue with nx monorepo. |
@VeeteshJain This package just matches the built-in TypeScript behaviour. I don't think we should differ from that? |
loadTsConfig
performs a deep merge on extended configurations:tsconfig-paths/src/tsconfig-loader.ts
Line 142 in d1cb8f5
… but this is not what TypeScript itself does when resolving extended configurations:
https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends
This manifested in a very confusing bug for us, whereby we were using
tsconfig-paths-webpack-plugin
(which uses this module) and module paths were being resolved to the wrong place.Reduced test case:
./shared/tsconfig.json
:./src/tsconfig.json
:Observe how
tsc
only uses thepaths
from./src/tsconfig.json
, whereastsconfig-paths
usespaths
from both./src/tsconfig.json
and./shared/tsconfig.json
.Actual vs expected:
Now if you use a module path of
shared/foo
, webpack will incorrectly use the file./src/foo.ts
whereas TS (tsc
) will correctly use the file./shared/foo.ts
.For this reason I would consider it a bug that this module uses a deep merge. Would you accept a PR which fixes this to match TypeScript's own behaviour (that is, override instead of merge)?
The text was updated successfully, but these errors were encountered: