aiji42/remix-esbuild-override

patch file doesn't work on Prisma v2.14.0

qaynam opened this issue Β· 1 comments

package.json

{
  "name": "app",
  "private": true,
  "sideEffects": false,
  "scripts": {
    "build": "remix build",
    "dev:remix": "remix watch",
    "dev:wrangler": "cross-env NODE_ENV=development wrangler pages dev ./public",
    "dev": "remix build && run-p dev:*",
    "start": "cross-env NODE_ENV=production npm run dev:wrangler",
    "typecheck": "tsc --noEmit",
    "postinstall": "patch-package && remix-esbuild-override",
    "generate": "cross-env PRISMA_CLIENT_ENGINE_TYPE=dataproxy prisma generate",
    "seed": "ts-node -r tsconfig-paths/register"
  },
  "dependencies": {
    "@emotion/css": "^11.9.0",
    "@mantine/core": "^4.2.1",
    "@mantine/dropzone": "^4.2.1",
    "@mantine/hooks": "^4.2.1",
    "@mantine/notifications": "^4.2.2",
    "@mantine/rte": "^4.2.1",
    "@mantine/ssr": "^4.2.1",
    "@nishanths/zoom.js": "^3.1.0",
    "@prisma/client": "^3.12.0",
    "@remix-run/cloudflare": "^1.5.1",
    "@remix-run/cloudflare-pages": "^1.5.1",
    "@remix-run/node": "^1.5.1",
    "@remix-run/react": "^1.5.1",
    "@remix-run/serve": "^1.5.1",
    "@remix-run/server-runtime": "^1.5.1",
    "@tabler/icons": "^1.67.1",
    "axios": "^0.27.2",
    "bcrypt": "^5.0.1",
    "cloudinary": "^1.29.1",
    "dotenv": "^16.0.1",
    "express": "^4.18.1",
    "geoip-lite": "^1.4.5",
    "highlight.js": "^11.5.1",
    "isbot": "^3.5.0",
    "jsonwebtoken": "^8.5.1",
    "marked": "^4.0.14",
    "nodemailer": "^6.7.3",
    "prisma": "^3.14.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-portal": "^4.2.2",
    "remix": "^1.5.1",
    "remix-utils": "^3.2.0",
    "styled-components": "^5.3.5"
  },
  "devDependencies": {
    "@cloudflare/workers-types": "^3.10.0",
    "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
    "@remix-run/dev": "^1.5.1",
    "@types/bcrypt": "^5.0.0",
    "@types/geoip-lite": "^1.4.1",
    "@types/jsonwebtoken": "^8.5.8",
    "@types/marked": "^4.0.3",
    "@types/node": "^17.0.36",
    "@types/nodemailer": "^6.4.4",
    "@types/react": "^17.0.24",
    "@types/react-dom": "^17.0.9",
    "@types/react-portal": "^4.0.4",
    "@types/styled-components": "^5.1.25",
    "cross-env": "^7.0.3",
    "esbuild-plugin-alias": "^0.2.1",
    "npm-run-all": "^4.1.5",
    "patch-package": "^6.4.7",
    "remix-esbuild-override": "^3.0.4",
    "ts-node": "^10.7.0",
    "tsconfig-paths": "^4.0.0",
    "typescript": "^4.1.2",
    "wrangler": "^2.0.7"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "platform": "node",
  "engines": {
    "node": ">=14"
  }
}

when i run yarn install it show error like thisπŸ‘‡


patch-package 6.4.7
Applying patches...

**ERROR** Failed to apply patch for package @prisma/client at path
  
    node_modules/@prisma/client

  This error was caused because @prisma/client has changed since you
  made the patch file for it. This introduced conflicts with your patch,
  just like a merge conflict in Git when separate incompatible changes are
  made to the same piece of code.

  Maybe this means your patch file is no longer necessary, in which case
  hooray! Just delete it!

  Otherwise, you need to generate a new patch file.

  To generate a new one, just repeat the steps you made to generate the first
  one.

  i.e. manually make the appropriate file changes, then run 

    patch-package @prisma/client

  Info:
    Patch file: patches/@prisma+client+3.12.0.patch
    Patch was made for version: 3.12.0
    Installed version: 3.14.0

---
patch-package finished with 1 error(s).
πŸ’½ esbuild patch by remix-esbuild-override is complete.

when i run yarn dev it got error like πŸ‘‡


Building Remix app in development mode...
πŸ’½ Override esbuild. Your custom config can be used to build for Remix.

✘ [ERROR] Could not resolve "async_hooks"

    node_modules/@prisma/client/runtime/index.js:67:45:
      67 β”‚ var import_async_hooks = __toModule2(require("async_hooks"));
         β•΅                                              ~~~~~~~~~~~~~

  The package "async_hooks" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

 ✘ [ERROR] Could not resolve "stream/web"

    node_modules/@prisma/client/runtime/index.js:27978:33:
      27978 β”‚         ReadableStream = require("stream/web").ReadableStream;
            β•΅                                  ~~~~~~~~~~~~

  The package "stream/web" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

 ✘ [ERROR] Could not resolve "perf_hooks"

    node_modules/@prisma/client/runtime/index.js:33032:34:
      33032 β”‚     var { performance } = require("perf_hooks");
            β•΅                                   ~~~~~~~~~~~~

  The package "perf_hooks" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

 ✘ [ERROR] Could not resolve "util/types"

    node_modules/@prisma/client/runtime/index.js:33546:35:
      33546 β”‚     var { isUint8Array } = require("util/types");
            β•΅                                    ~~~~~~~~~~~~

  The package "util/types" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.


Build failed with 4 errors:
node_modules/@prisma/client/runtime/index.js:67:45: ERROR: Could not resolve "async_hooks"
node_modules/@prisma/client/runtime/index.js:27978:33: ERROR: Could not resolve "stream/web"
node_modules/@prisma/client/runtime/index.js:33032:34: ERROR: Could not resolve "perf_hooks"
node_modules/@prisma/client/runtime/index.js:33546:35: ERROR: Could not resolve "util/types"
Error
    at Object.onBuildFailure (/work/app/node_modules/@remix-run/dev/cli/commands.js:157:13)
    at buildEverything (/work/app/node_modules/@remix-run/dev/compiler.js:281:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.build (/work/app/node_modules/@remix-run/dev/compiler.js:106:3)
    at async Object.build (/work/app/node_modules/@remix-run/dev/cli/commands.js:152:3)
    at async Object.run (/work/app/node_modules/@remix-run/dev/cli/run.js:470:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have updated the patch (f43d771), please refer to it from the latest main branch.

The error on yarn dev is caused by you not generating prisma client in dataproxy mode, please read the README.

  1. Use Prisma Data Proxy

Please refer to this document to prepare for using Prisma Data Proxy. When running prisma generate, be sure to specify the environment variable PRISMA_CLIENT_ENGINE_TYPE='dataproxy'.