Fix drizzle-kit tsconfig path alias resolution#5417
Open
dankochetov wants to merge 16 commits intobetafrom
Open
Fix drizzle-kit tsconfig path alias resolution#5417dankochetov wants to merge 16 commits intobetafrom
dankochetov wants to merge 16 commits intobetafrom
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in drizzle-kit’s TS module loading by resolving tsconfig.json path aliases when loading schema/config modules via jiti, and adds tests/fixtures to validate wildcard and non-wildcard alias imports.
Changes:
- Add
get-tsconfigdependency and use it to readcompilerOptions.paths/baseUrl. - Build a
jitialiasmap fromtsconfigpaths insideloadModule(). - Add fixtures + Vitest coverage for alias-based schema imports and CLI config loading.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds lock entries for get-tsconfig and updates dependent snapshots. |
| drizzle-kit/package.json | Adds get-tsconfig as a runtime dependency. |
| drizzle-kit/src/utils/utils-node.ts | Updates loadModule() to read tsconfig and configure jiti aliases accordingly. |
| drizzle-kit/tests/other/load-module.test.ts | Adds a direct test ensuring loadModule() can load a TS module that uses tsconfig aliases. |
| drizzle-kit/tests/other/cli-generate.test.ts | Adds a CLI test ensuring generate succeeds with schema imports using aliases. |
| drizzle-kit/tests/fixtures/tsconfig-paths/tsconfig.json | Fixture tsconfig with wildcard and non-wildcard paths. |
| drizzle-kit/tests/fixtures/tsconfig-paths/src/user/schema.ts | Fixture schema importing via both alias styles (@/* and @profile). |
| drizzle-kit/tests/fixtures/tsconfig-paths/src/profile/schema.ts | Fixture profile schema. |
| drizzle-kit/tests/fixtures/tsconfig-paths/entry.ts | Fixture entrypoint exporting schemas. |
| drizzle-kit/tests/fixtures/tsconfig-paths/drizzle.config.ts | Fixture drizzle config referencing the alias-using schema entry. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 task
* added node:sqlite support driver to drizzle-kit * fix * updated compatibilityVersion * added node version warn for node:sqlite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get-tsconfig+ jitialiasmappingNotes
tsconfigPathswhich was implemented in feat: support opt-intsconfigPathsunjs/jiti#427, butv2.6.1on npm does not include it; usingaliasmapping as a workaroundtsconfigPathsinstead ofaliasfor better paths resolution once feat: support opt-intsconfigPathsunjs/jiti#427 is released to npmFixes #5365