Background
The packages/env TypeScript package fails to emit .js output files during the build phase, causing downstream packages (e.g., apps/dashboard) to fail with module resolution errors:
Module not found: Can't resolve './schemas/dashboard.js'
Module not found: Can't resolve './validate.js'
This occurs because packages/env/tsconfig.json likely lacks explicit configuration for TypeScript output generation.
Problem
Without explicit outDir and emitDeclarationOnly settings, TypeScript may:
- Only emit
.d.ts files without corresponding .js files
- Emit to an unexpected or unmapped directory
- Skip JavaScript emission entirely if
emitDeclarationOnly defaults to true
Downstream packages importing from packages/env expect both .d.ts and .js files in a predictable location (typically dist/).
Expected Outcome
The packages/env/tsconfig.json includes explicit, correct settings:
"declaration": true (emit .d.ts files)
"emitDeclarationOnly": false (also emit .js files)
"outDir": "./dist" (output to a known directory)
- Build produces both
.js and .d.ts files in packages/env/dist/
Suggested Implementation
- Review
packages/env/tsconfig.json and identify current settings for outDir, declaration, and emitDeclarationOnly
- Update to:
{
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"emitDeclarationOnly": false,
"module": "esnext",
"target": "es2020",
"moduleResolution": "bundler"
}
}
- Run
pnpm build -r --filter @guildpass/env
- Verify
packages/env/dist/ contains both .js and .d.ts files
- Run
pnpm -r build to confirm downstream packages now resolve correctly
Acceptance Criteria
Affected Files/Directories
packages/env/tsconfig.json
packages/env/dist/ (output)
Background
The
packages/envTypeScript package fails to emit.jsoutput files during the build phase, causing downstream packages (e.g.,apps/dashboard) to fail with module resolution errors:This occurs because
packages/env/tsconfig.jsonlikely lacks explicit configuration for TypeScript output generation.Problem
Without explicit
outDirandemitDeclarationOnlysettings, TypeScript may:.d.tsfiles without corresponding.jsfilesemitDeclarationOnlydefaults to trueDownstream packages importing from
packages/envexpect both.d.tsand.jsfiles in a predictable location (typicallydist/).Expected Outcome
The
packages/env/tsconfig.jsonincludes explicit, correct settings:"declaration": true(emit.d.tsfiles)"emitDeclarationOnly": false(also emit.jsfiles)"outDir": "./dist"(output to a known directory).jsand.d.tsfiles inpackages/env/dist/Suggested Implementation
packages/env/tsconfig.jsonand identify current settings foroutDir,declaration, andemitDeclarationOnly{ "compilerOptions": { "outDir": "./dist", "declaration": true, "emitDeclarationOnly": false, "module": "esnext", "target": "es2020", "moduleResolution": "bundler" } }pnpm build -r --filter @guildpass/envpackages/env/dist/contains both.jsand.d.tsfilespnpm -r buildto confirm downstream packages now resolve correctlyAcceptance Criteria
packages/env/tsconfig.jsonexplicitly setsoutDir,declaration, andemitDeclarationOnlypnpm build -r --filter @guildpass/env,packages/env/dist/contains.jsfiles (not only.d.ts)packages/env/dist/schemas/dashboard.js,packages/env/dist/validate.jsexistpnpm -r buildsucceeds (no "Module not found" errors inapps/dashboard)Affected Files/Directories
packages/env/tsconfig.jsonpackages/env/dist/(output)