question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build failed in Remix app when using @casl/prisma

See original GitHub issue

Describe the bug Build failed when using @casl/prisma in a Remix app due to importing from “./runtime” instead of “./runtime.mjs”

Could not resolve "./runtime"
node_modules/@casl/prisma/dist/es6m/index.mjs:1:154:
      1 │ ... as o,prismaQuery as e}from"./runtime";export{ParsingQueryError,...

To Reproduce

  1. Install @casl/ability and @casl/prisma in a remix run app. I used the Indie Stack starter template.
  2. Build the app using the npm run dev script.
  3. The error occurs on build.

Expected behavior A clean build.

By modifying the file node_modules/@casl/prisma/dist/es6m/index.mjs to change all import * from "./runtime" to import * from "./runtime.mjs", I was able to get a clean and working build.

CASL Version

@casl/ability - v6.3.2 @casl/prisma -v1.3.1

Environment: node -v18.4.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
stalniycommented, Nov 18, 2022

fixed in @casl/prisma@1.3.3

1reaction
jlwbrcommented, Nov 2, 2022

This patch can be used with patch-package as a temporary fix

diff --git a/node_modules/@casl/prisma/dist/es6m/index.mjs b/node_modules/@casl/prisma/dist/es6m/index.mjs
index 793f2c1..af2ec67 100644
--- a/node_modules/@casl/prisma/dist/es6m/index.mjs
+++ b/node_modules/@casl/prisma/dist/es6m/index.mjs
@@ -1,2 +1,2 @@
-import{PureAbility as r,fieldPatternMatcher as t}from"@casl/ability";import{createAbilityFactory as i,createAccessibleByFactory as o,prismaQuery as e}from"./runtime";export{ParsingQueryError,prismaQuery}from"./runtime";const s=i();const c=o();class PrismaAbility extends r{constructor(r,i){super(r,Object.assign({conditionsMatcher:e,fieldMatcher:t},i))}}export{PrismaAbility,c as accessibleBy,s as createPrismaAbility};
+import{PureAbility as r,fieldPatternMatcher as t}from"@casl/ability";import{createAbilityFactory as i,createAccessibleByFactory as o,prismaQuery as e}from"./runtime.mjs";export{ParsingQueryError,prismaQuery}from"./runtime.mjs";const s=i();const c=o();class PrismaAbility extends r{constructor(r,i){super(r,Object.assign({conditionsMatcher:e,fieldMatcher:t},i))}}export{PrismaAbility,c as accessibleBy,s as createPrismaAbility};
 //# sourceMappingURL=index.mjs.map
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug]: PrismaClient execution fails on @remix-run/cloudflare ...
Use create -remix to create a project. Select Cloudflare Workers at that time. Install and build prisma. Write new PrismaClient() in the loader ......
Read more >
Build A Fullstack App with Remix, Prisma & MongoDB
Learn how to build and deploy a fullstack application using Remix, Prisma, and MongoDB. In this article, we will be setting up ...
Read more >
Build error in Remix app with Prisma seed file - Support
I added Prisma to my previously deployed Remix project and when I pushed it to a remote branch and Netlify picked up the...
Read more >
React Remix - Issue with finding @prisma/client module - Fly.io
I am not sure what the issue could be. I only update the Prisma client and have tried multiple things to try and...
Read more >
Error about Prisma in Remix's Jokes App tutorial
In Remix's Jokes App tutorial, I got an error in the process of getting a user in session.server.ts. I think the error is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found