fix(build): make prisma-client output runnable after nest build
Production image bootlooped with:
Cannot find module './internal/class.ts'
at /app/dist/generated/prisma/client.js:40:29
The Prisma 7 `prisma-client` generator (provider="prisma-client" in
schema.prisma) emits TypeScript source whose internal imports use
explicit `.ts` extensions (import x from "./internal/class.ts").
With module=nodenext, tsc preserves those extensions in the emitted
JS unless rewriteRelativeImportExtensions is on, so the compiled
client did `require("./internal/class.ts")` at runtime → ENOENT.
Set rewriteRelativeImportExtensions: true in tsconfig.json (added in
TS 5.7, we're on 5.7.3). tsc now rewrites .ts → .js in the emitted
require calls, matching the .js files actually present.
Also add a .dockerignore. The local smoke test was passing because
the COPY . . step was overlaying a pre-existing generated/prisma/
(left over from a previous prisma-client-js install with .js output)
on top of the fresh .ts output from `npm ci`'s postinstall. CI's
clean checkout had no override, so the bug was visible there first.
Excluding generated/, node_modules/, and dist/ from the build
context forces every build (local and CI) to use the fresh
regenerated output — same code path everywhere.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
node_modules
|
||||
dist
|
||||
generated
|
||||
coverage
|
||||
.git
|
||||
.gitignore
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
*.log
|
||||
.vscode
|
||||
.idea
|
||||
.DS_Store
|
||||
@@ -3,6 +3,7 @@
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext",
|
||||
"resolvePackageJsonExports": true,
|
||||
"rewriteRelativeImportExtensions": true,
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"declaration": true,
|
||||
|
||||
Reference in New Issue
Block a user