Description and expected behavior
After migrating Zenstack in my NestJS app from V2 to V3 the app fails on startup with an error regarding a dependency used in the better-auth integration package. I created a new fresh project with the NestJS CLI and can reproduce the error after I installed better-auth and initialized it using Zenstack's better-auth integration package.
Screenshots
node:internal/modules/cjs/loader:692
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/sash/Documents/projects/test/zenstack-nest/node_modules/langium/package.json
at exportsNotFound (node:internal/modules/esm/resolve:310:10)
at packageExportsResolve (node:internal/modules/esm/resolve:601:13)
at resolveExports (node:internal/modules/cjs/loader:685:36)
at Module._findPath (node:internal/modules/cjs/loader:752:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1461:27)
at wrapResolveFilename (node:internal/modules/cjs/loader:1049:27)
at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1073:10)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1094:12)
at Module._load (node:internal/modules/cjs/loader:1262:25)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Environment:
- ZenStack version: 3.6.4
- Database type: PostgreSQL / Sqlite
- Node.js version: 24.15.0
- Package manager: npm
Additional context
App running on NestJS v11 with better-auth v1.6.9.
auth.ts:
const db = new ZenStackClient(schema, {
dialect: new SqliteDialect({
database: new SQLite('../../zenstack/dev.db'),
}),
});
export const auth = betterAuth({
database: zenstackAdapter(db, {
provider: 'sqlite',
}),
// other better-auth options...
});
tsconfig:
{
"compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"resolvePackageJsonExports": true,
"esModuleInterop": true,
"isolatedModules": true,
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2025",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": false,
"strictBindCallApply": false,
"noFallthroughCasesInSwitch": false
}
}
Description and expected behavior
After migrating Zenstack in my NestJS app from V2 to V3 the app fails on startup with an error regarding a dependency used in the better-auth integration package. I created a new fresh project with the NestJS CLI and can reproduce the error after I installed better-auth and initialized it using Zenstack's better-auth integration package.
Screenshots
Environment:
Additional context
App running on NestJS v11 with better-auth v1.6.9.
auth.ts:
tsconfig: