Skip to content

Nuxt update to verbatimModuleSyntax breaks prisma seeding 'ESM syntax is not allowed' #18

@JavascriptMick

Description

@JavascriptMick

Nuxt has changed to verbatimModuleSyntax True

look in this file...

.nuxt/tsconfig.json

and you will see this..

"verbatimModuleSyntax": true,

This breaks prisma DB seeding i.e. this..

npx prisma db push

gives you an error like this

ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.

then some bullshit with node types being missing "process can't be found'

I have fixed this in a downstream project by doing the following. Not sure if I should bring it back to the main repo or if it is the best fix.....

I needed to add this to .tsconfig (for the missing process bullshit)

  "compilerOptions": {
    "types": ["node"]
  }

change to this in package.json

  "prisma": {
    "seed": "ts-node prisma/seed.ts"
  },

and do this in seed.ts

const { PrismaClient } = require('@prisma/client');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions