Skip to content

Commit cb01441

Browse files
committed
fix(db): resolve @sim/db self-imports under scripts/ in vitest
Vite 8.3 applies tsconfig paths only to files the tsconfig includes. packages/db excludes scripts/, so script modules and their tests lost the @sim/db/* mapping and fell through to package exports, which do not list them.
1 parent da6edcd commit cb01441

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/db/vitest.config.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ export default defineConfig(({ mode }) => {
1010
return mergeConfig(
1111
integration ? mergeConfig(sharedConfig, integrationTestConfig) : sharedConfig,
1212
defineConfig({
13-
resolve: { tsconfigPaths: true },
13+
resolve: {
14+
tsconfigPaths: true,
15+
// Mirrors tsconfig's `@sim/db/*` path: tsconfig.json excludes scripts/, and Vite only
16+
// applies `paths` to files the tsconfig includes, so modules under scripts/ need it here.
17+
alias: [{ find: /^@sim\/db\//, replacement: `${import.meta.dirname}/` }],
18+
},
1419
test: {
1520
include: integration
1621
? ['**/*.integration.ts']

0 commit comments

Comments
 (0)