Skip to content

Add explicit declaration and emitDeclarationOnly settings to packages/env tsconfig.json #334

Description

@Lakes41

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:

  1. Only emit .d.ts files without corresponding .js files
  2. Emit to an unexpected or unmapped directory
  3. 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

  1. Review packages/env/tsconfig.json and identify current settings for outDir, declaration, and emitDeclarationOnly
  2. Update to:
    {
      "compilerOptions": {
        "outDir": "./dist",
        "declaration": true,
        "emitDeclarationOnly": false,
        "module": "esnext",
        "target": "es2020",
        "moduleResolution": "bundler"
      }
    }
  3. Run pnpm build -r --filter @guildpass/env
  4. Verify packages/env/dist/ contains both .js and .d.ts files
  5. Run pnpm -r build to confirm downstream packages now resolve correctly

Acceptance Criteria

  • packages/env/tsconfig.json explicitly sets outDir, declaration, and emitDeclarationOnly
  • After pnpm build -r --filter @guildpass/env, packages/env/dist/ contains .js files (not only .d.ts)
  • Files like packages/env/dist/schemas/dashboard.js, packages/env/dist/validate.js exist
  • Full workspace build pnpm -r build succeeds (no "Module not found" errors in apps/dashboard)

Affected Files/Directories

  • packages/env/tsconfig.json
  • packages/env/dist/ (output)

Metadata

Metadata

Assignees

Labels

Third CampaignOfficial FWC26 campaign issue — eligible for campaign scoring and rewardsbuildUser interface or user experience improvements and design workintermediateIntermediate difficulty tasks requiring solid experience and some contexttype-safetyTypeScript type system improvements and strict type enforcement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions