Closed ericmesmo closed 4 months ago
Resolved here: #189
@ericmesmo In your case, to use a distinct tsconfig
in a package, it has to go through the dev or build step.
First, configure your dist directory in env-config/tsconfig.json
:
{
"extends": "@repo/typescript-config/base.json",
"include": ["index.ts"],
+ "exclude": ["dist"],
+ "compilerOptions": {
+ "outDir": "dist"
+ },
}
Then, update endpoints and scripts in env-config/package.json
:
{
"name": "@repo/env-config",
"version": "1.0.0",
"description": "",
"private": true,
- "main": "index.ts",
+ "main": "dist/index.js",
- "types": "index.ts",
+ "types": "dist/index.d.ts",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
+ "build": "tsc",
+ "dev": "tsc --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@t3-oss/env-core": "^0.10.1",
"ts-node": "^10.9.1",
"tsup": "^8.1.0",
"typescript": "^5.4.5",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/node": "^20.14.2",
"typescript": "^5.4.5",
"@repo/typescript-config": "workspace:*"
}
}
Now you can build your apps that use the env-config
package:
pnpm build
I couldn't find a solution, could someone help me?
The error explains how to solve this:
This is also mentioned in the readme of this repo and in the docs
I'm using turborepo and in it I have a package to get the application's variables, whether front or back.
When using the @repo/env-config package within the api application, which uses nestjs, an error is returned: Cannot find module '@t3-oss/env-core' or its corresponding type declarations.
I couldn't find a solution, could someone help me?
A repo to reproduce the error: https://github.com/ericmesmo/reproducible