Backend & APISûr100100/100
Prisma Upgrade V7 Esm Support (Prisma)
ESM Support. Reference when using this Prisma feature.
ou envoie-le directement à ton agent.
Installer dans ton projet
$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs prisma-upgrade-v7-esm-support__prisma-cursor-plugin__skills-3e39a5f65384Prisma
prisma/cursor-plugin
Contenu à copier
---
name: prisma-upgrade-v7-esm-support
description: ESM Support. Reference when using this Prisma feature.
license: MIT
metadata:
origin: Prisma
author: prisma
version: "7.0.0"
---
# ESM Support
Prisma ORM v7 ships as an ES module only. Your project must be configured for ESM.
## Required Changes
### package.json
Add the `type` field:
```json
{
"type": "module",
"scripts": {
"build": "tsc",
"start": "node dist/index.js"
}
}
```
### tsconfig.json
Configure for ESM:
```json
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2023",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"outDir": "dist"
},
"include": ["src/**/*", "prisma/**/*"]
}
```
### Alternative: Node16/NodeNext
```json
{
"compilerOptions": {
"module": "Node16",
"moduleResolution": "Node16",
"target": "ES2022"
}
}
```
## Import Syntax Changes
### Named imports
```typescript
// ESM (v7)
import { PrismaClient } from '../generated/client'
// Not: require()
```
### File extensions
With `moduleResolution: "Node16"`, add `.js` extensions:
```typescript
import { helper } from './utils/helper.js'
```
With `moduleResolution: "bundler"`, extensions are optional.
## Minimum Versions
| Requirement | Minimum Version |
|-------------|-----------------|
| Node.js | 20.19.0 |
| TypeScript | 5.4.0 |
## CommonJS Compatibility
If you must use CommonJS:
### Dynamic import
```javascript
// CommonJS file
async function main() {
const { PrismaClient } = await import('../generated/client.js')
const prisma = new PrismaClient()
}
```
### Separate ESM file
Create an ESM wrapper:
```javascript
// prisma.mjs
import { PrismaClient } from '../generated/client'
export const prisma = new PrismaClient()
```
## Framework Considerations
### Next.js
Next.js supports ESM. Ensure `next.config.js` → `next.config.mjs`:
```javascript
// next.config.mjs
export default {
// config
}
```
### Express
Update entry point:
```javascript
// index.js (with "type": "module")
import express from 'express'
import { PrismaClient } from '../generated/client'
const app = express()
const prisma = new PrismaClient()
```
### Jest
Configure Jest for ESM:
```json
{
"jest": {
"preset": "ts-jest/presets/default-esm",
"extensionsToTreatAsEsm": [".ts"],
"transform": {
"^.+\\.tsx?$": ["ts-jest", { "useESM": true }]
}
}
}
```
Or use Vitest which has native ESM support.
## Troubleshooting
### "ERR_REQUIRE_ESM"
Your code is using `require()` on an ESM module. Switch to `import`.
### "Cannot use import statement outside a module"
Add `"type": "module"` to package.json.
### TypeScript compilation errors
Ensure `module` and `moduleResolution` are set correctly in tsconfig.json.Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.
Ce que fait Prisma Upgrade V7 Esm Support (Prisma)
Applique les pratiques du skill prisma-upgrade-v7-esm-support__prisma-cursor-plugin__skills-3e39a5f65384.
Comment utiliser Prisma Upgrade V7 Esm Support (Prisma)
1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.
Déclencheurs pour Prisma Upgrade V7 Esm Support (Prisma)
Dis simplement à ton agent quelque chose comme :
Applique le skill prisma-upgrade-v7-esm-support__prisma-cursor-plugin__skills-3e39a5f65384 à cette tâche
Utilise prisma-upgrade-v7-esm-support__prisma-cursor-plugin__skills-3e39a5f65384 pour améliorer cette implémentation
Passe en revue ce sujet avec prisma-upgrade-v7-esm-support__prisma-cursor-plugin__skills-3e39a5f65384
Skills liés à Prisma Upgrade V7 Esm Support (Prisma)
Activate Site (Microsoft)
Activates and provisions a Power Pages website in a Power Platform environment via the Power Platform REST API. Use when the user wants to activate, provision, turn on, or enable a Power Pages website or portal.IA Core (TanStack)
Entry point for TanStack AI skills. Routes to chat-experience, tool-calling, media-generation, structured-outputs, adapter-configuration, ag-ui-protocol, middleware, locks, custom-backend-integration, and debug-logging, plus the skills shipped by companion packages (@tanstack/ai-persistence, @tanstack/ai-code-mode). Use chat() not streamText(), openaiText() not createOpenAI(), toServerSentEventsResponse() not manual SSE, middleware hooks not onEnd callbacks.api-connector-builder
Build a new API connector or provider by matching the target repo's existing integration pattern exactly. Use when adding one more integration without inventing a second architecture.