-
-
Notifications
You must be signed in to change notification settings - Fork 74
Description
Hay, I have a monorepo setup with pnpm workspace, I can't tell why but external modules like zod is resolved e.g.
import "zod";
resolves into
import "./zod";
And paths that actually needs to be resolved doesn't resolve.
tsconfig:
`{
"compilerOptions": {
"composite": true,
"moduleResolution": "node",
"target": "ES6",
"module": "commonjs",
"strict": true,
"strictNullChecks": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"noImplicitAny": true,
"noUnusedParameters": true,
// Build
"rootDir": "./src",
"outDir": "./dist",
// Paths
"baseUrl": "./",
"paths": {
"@tirgul/db/*": ["../db/dist/*"]
}
},
"references": [{ "path": "../db" }],
"include": ["./src"]
}`
src:
`import { z } from "zod";
export { zodSchemas as zod } from "@tirgul/db/index";
export const PaginationSchema = z.object({
limit: z.number().min(1).max(100),
offset: z.number().min(0),
});`
output:
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PaginationSchema = exports.zod = void 0; const zod_1 = require("./zod"); var index_1 = require("@tirgul/db/index"); Object.defineProperty(exports, "zod", { enumerable: true, get: function () { return index_1.zodSchemas; } }); exports.PaginationSchema = zod_1.z.object({ limit: zod_1.z.number().min(1).max(100), offset: zod_1.z.number().min(0), });
build command:
tsc --build && tsc-alias -p ./tsconfig.json
tsc-alias version: "tsc-alias": "^1.8.16"
I can add --verbose --debug if needed...