does Prisma works with monorepos? I have such an e...
# orm-help
p
does Prisma works with monorepos? I have such an error
Error during invocation:  Error: ENOENT: no such file or directory, open '/schema.prisma'
and can see many issues on the GitHub about similar problems.
s
I use Prisma with Nx. Feel free to DM me with any questions!
e
It depends on how you bundle your app and where your PrismaClient is generated 🙂 For me, I’m also using Nx and the Prisma schema and binaries are not copied over automatically to the built folder. Here’s how I solved mine by extending the default config:
Copy code
const CopyWebpackPlugin = require("copy-webpack-plugin");

module.exports = (config) => {
  // TODO: Work around <https://github.com/prisma/prisma/pull/8842>
  config.externals.push("encoding", "_http_common");

  // Copy non .ts files that are needed by the app in prod
  config.plugins.push(
    new CopyWebpackPlugin({
      patterns: [
        { from: "libs/graph-prisma/src/prisma/generated/prisma-client-js/libquery_engine*", to: "[name][ext]" },
        "libs/graph-prisma/src/prisma/generated/prisma-client-js/schema.prisma",
      ],
    })
  );

  return config;
};
Oh wait sorry, this is not about building. Nevermind! 😄
p
yeah, that was a bug in Prisma, workaround already available: https://github.com/prisma/prisma/issues/9435#issuecomment-1049780015
🔥 1