Skip to content

[Bug]: Error import package prisma in monorepo (turbo, pnpm) for adminjs 7+ (esm) #1769

Open

Description

@dev-chief

Contact Details

effectwaater@gmail.com

What happened?

I have a project structure:

apps
   api (express)
   web
      adminjs ( version 7 +, AdminJS only supports ESM)
   packages 
       prisma 
  pnpm-lock.yaml
  pnpm-workspace.yaml

I get an error in adminjs:

2025-06-27 12:27:43 SyntaxError: Named export 'Prisma' not found. The requested module '@prisma/client' is a CommonJS module, which may not support all module.exports as named exports.
2025-06-27 12:27:43 CommonJS modules can always be imported via the default export, for example using:
2025-06-27 12:27:43
2025-06-27 12:27:43 import pkg from '@prisma/client';
2025-06-27 12:27:43 const { Prisma } = pkg;
2025-06-27 12:27:43
2025-06-27 12:27:43 at #_instantiate (node:internal/modules/esm/module_job:249:21)
2025-06-27 12:27:43 at async ModuleJob.run (node:internal/modules/esm/module_job:357:5)
2025-06-27 12:27:43 at async onImport.tracePromise.proto (node:internal/modules/esm/loader:665:26)
2025-06-27 12:27:43 at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:99:5)

When importing (for adminjs) the package @mycompany/prisma:

import { Database, Resource } from '@adminjs/prisma';
import { prisma } from '@mycompany/prisma'; < --------------- this error
import AdminJS from 'adminjs';
AdminJS.registerAdapter({ Database, Resource });
const initialize = async () => ({ prisma });
export default initialize;
export { prisma };

Bug prevalence

Critical error

AdminJS dependencies version

apps/web/adminjs/package.json

{
"name": "@mycompany/adminjs",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "rm -rf dist && tsc --watch",
"build": "rm -rf dist && tsc"
},
"dependencies": {
"@mycompany/prisma": "workspace:*",
"@adminjs/express": "6.1.1",
"@adminjs/prisma": "5.0.4",
"adminjs": "7.8.16",
"express": "^5.1.0",
"express-formidable": "^1.2.0",
"express-session": "^1.18.1",
"pg": "latest"
},
"devDependencies": {
"@types/react": "19.1.8",
"@types/express": "^5.0.3",
"@types/node": "^24.0.4",
"prettier": "^3.6.1",
"ts-node": "latest",
"tslib": "^2.8.1",
"tsx": "latest",
"typescript": "^5.8.3"
}
}

packages/prisma/package.json

{
"name": "@mycompany/prisma",
"version": "0.0.1",
"main": "index.ts",
"exports": {
".": "./index.ts"
},
"files": [
"client/index.js",
"client/index.d.ts",
"schema.prisma"
],
"scripts": {
"prisma:studio": "npx prisma studio --port 5555",
"prisma:push": "prisma db push",
"prisma:generate": "npx prisma generate",
"prisma:seed": "tsx src/seed.ts"
},
"prisma": {
"schema": "prisma/schema.prisma"
},
"devDependencies": {
"eslint": "9.29.0",
"tsup": "8.5.0",
"tsx": "4.20.3",
"typescript": "5.8.3",
"prisma": "6.10.q"
},
"dependencies": {
"@prisma/client": "6.10.1"
}
}

What browsers do you see the problem on?

Chrome

Relevant log output

Relevant code that's giving you issues

**apps/packages/prisma/package.json**

> import { PrismaClient } from "./client/index.js"; 
  export const prisma = new PrismaClient();
  export * from "./client/index.js";   


**apps/packages/prisma/package.json**

> datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = []
  output   = "../client" // Для доступа к типам данных сылаемся на сгенерированный пак
  binaryTargets   = ["native", "linux-musl-arm64-openssl-3.0.x"]
}

Activity

  1. added
    bug
    on Jun 27, 2025
  2. changed the title [-][Bug]:[/-] [+][Bug]: Error import package prisma in monorepo (turbo, pnpm) for adminjs 7+ (esm)[/+] on Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions