Background
The apps/dashboard Next.js app fails with multiple module resolution errors during the build step:
Module not found: Can't resolve './schemas/dashboard.js'
These errors point to issues upstream in packages/env, but also suggest that apps/dashboard's Next.js configuration may not be optimally handling monorepo imports or TypeScript paths.
Problem
- Unclear path resolution:
apps/dashboard may not have jsconfig.json or tsconfig.json properly configured for monorepo imports
- No path aliases: Hardcoded relative imports (
../../packages/env) are error-prone
- TypeScript/Next.js mismatch: Next.js may not be respecting the workspace
tsconfig.base.json or custom paths
- No documentation: It's unclear how the dashboard is intended to import from packages
Expected Outcome
apps/dashboard/tsconfig.json properly configured for Next.js 14 and monorepo structure
- Path aliases (e.g.,
@guildpass/*) defined for clean imports
- Clear import strategy documented
- Dashboard builds successfully and imports all required packages
Suggested Implementation
-
Review and update apps/dashboard/tsconfig.json:
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"jsx": "preserve",
"incremental": true,
"paths": {
"@guildpass/*": [
"../../packages/*"
]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
-
Update imports in apps/dashboard/ to use path aliases:
// Before
import { validateEnv } from '../../packages/env/dist/index';
// After
import { validateEnv } from '@guildpass/env';
-
Verify apps/dashboard/package.json includes proper Next.js dependencies (next, react, react-dom at appropriate versions)
-
Add apps/dashboard/.env.local (if needed) with any required environment variables
-
Update Next.js build configuration in apps/dashboard/next.config.js if needed:
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['@guildpass/env', '@guildpass/integration-client'],
};
module.exports = nextConfig;
This ensures monorepo packages are transpiled by Next.js.
-
Test build:
pnpm build -r --filter apps/dashboard
-
Document in apps/dashboard/README.md:
## Setup
### Path Aliases
The dashboard uses path aliases for clean imports:
- `@guildpass/env` → `../../packages/env`
- `@guildpass/integration-client` → `../../packages/integration-client`
### Building
The build process:
1. Builds all upstream packages (`packages/env`, etc.)
2. Transpiles monorepo packages via Next.js
3. Outputs to `.next/`
Acceptance Criteria
Affected Files/Directories
apps/dashboard/tsconfig.json
apps/dashboard/next.config.js
apps/dashboard/package.json (verify dependencies)
apps/dashboard/app/**/*.tsx (update imports to use aliases)
apps/dashboard/README.md (document)
Background
The
apps/dashboardNext.js app fails with multiple module resolution errors during the build step:These errors point to issues upstream in
packages/env, but also suggest thatapps/dashboard's Next.js configuration may not be optimally handling monorepo imports or TypeScript paths.Problem
apps/dashboardmay not havejsconfig.jsonortsconfig.jsonproperly configured for monorepo imports../../packages/env) are error-pronetsconfig.base.jsonor custom pathsExpected Outcome
apps/dashboard/tsconfig.jsonproperly configured for Next.js 14 and monorepo structure@guildpass/*) defined for clean importsSuggested Implementation
Review and update
apps/dashboard/tsconfig.json:{ "extends": "../../tsconfig.base.json", "compilerOptions": { "lib": [ "dom", "dom.iterable", "esnext" ], "jsx": "preserve", "incremental": true, "paths": { "@guildpass/*": [ "../../packages/*" ] } }, "include": [ "next-env.d.ts", "**/*.ts", "**/*.tsx" ], "exclude": [ "node_modules" ] }Update imports in
apps/dashboard/to use path aliases:Verify
apps/dashboard/package.jsonincludes proper Next.js dependencies (next, react, react-dom at appropriate versions)Add
apps/dashboard/.env.local(if needed) with any required environment variablesUpdate Next.js build configuration in
apps/dashboard/next.config.jsif needed:This ensures monorepo packages are transpiled by Next.js.
Test build:
Document in
apps/dashboard/README.md:Acceptance Criteria
apps/dashboard/tsconfig.jsonextendstsconfig.base.jsonand defines path aliasesnext.config.jsincludestranspilePackagesfor monorepo packages@guildpass/*in the dashboard use path aliases (no relative imports)pnpm build -r --filter apps/dashboardsucceedsAffected Files/Directories
apps/dashboard/tsconfig.jsonapps/dashboard/next.config.jsapps/dashboard/package.json(verify dependencies)apps/dashboard/app/**/*.tsx(update imports to use aliases)apps/dashboard/README.md(document)