Skip to content

fix: Prisma client module resolution in production Docker builds - #98

Closed
wiktoriavh wants to merge 1 commit into
mainfrom
fix/prisma-docker-import-extensions
Closed

fix: Prisma client module resolution in production Docker builds#98
wiktoriavh wants to merge 1 commit into
mainfrom
fix/prisma-docker-import-extensions

Conversation

@wiktoriavh

Copy link
Copy Markdown
Member

Summary

  • Set importFileExtension = "js" in the Prisma generator so the generated client uses runtime-safe ESM import paths
  • Copy tsconfig.json into the Docker build stage before running prisma generate, so Prisma can infer the correct module settings during image builds

Context

Production deploys were failing with ERR_MODULE_NOT_FOUND for /app/dist/generated/prisma/internal/class.ts because prisma generate ran before tsconfig.json was available in the Docker build context. Without it, Prisma defaults to .ts import extensions, which Node cannot resolve after the app is compiled to JavaScript.

Test plan

  • Rebuild the production Docker image
  • Run docker compose run --rm migrate and docker compose up -d bot
  • Confirm the bot container starts without ERR_MODULE_NOT_FOUND
  • Verify the bot connects and responds to Discord as expected

Made with Cursor

Prisma generate ran before tsconfig.json was available in the Docker build, so the client was emitted with .ts import paths that Node cannot resolve at runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
@wiktoriavh wiktoriavh changed the title Fix Prisma client module resolution in production Docker builds fix: Prisma client module resolution in production Docker builds Aug 23, 2026
@wiktoriavh wiktoriavh closed this Aug 23, 2026
@wiktoriavh
wiktoriavh deleted the fix/prisma-docker-import-extensions branch August 23, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant