nexus-prisma: Doesn't work with ES modules
Hello ๐๐ป
As I can see #124 was implemented but I have some problems with it. When I try to import nexus-prisma it still tries to import cjs module so I get errors trying to run my app.
Any ideas? type is set to โmoduleโ and nexus-prisma is imported using โimportโ keyword

EDIT: If I change import to
import nexusPrisma from 'nexus-prisma';
const {FuelStation} = nexusPrisma
then I get the following error:
(node:56355) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/Volumes/Workspace/pets/cheapoil/core/node_modules/nexus-prisma/dist-esm/entrypoints/main.js:1
import { inspect } from 'util';
^^^^^^
SyntaxError: Cannot use import statement outside a module
_Originally posted by @MikeYermolayev in https://github.com/prisma/nexus-prisma/discussions/141_
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 17 (6 by maintainers)
ES modules is still not work. To use
@apollo/server, i have to change mytypetomodule. When i run my project, some error shown:And i make this change and restart, some error throw:
https://github.com/graphql-nexus/nexus-prisma/discussions/141
Looks like the problem is in wrong build for esm. Imports inside esm should contain extensions but as I can see they donโt.
Iโll try to look into this during this week (Nov 17- Nov 21)
I have a problem with new Next.js 12 and nexus-prisma, it gives me error something like nexus-prisma dependency @client/prisma is not installed, ofc it is installed and reverting to last version of Next.js fixes problem. It is probably something similar to problems other people have with es modules.
No worries @jasonkuhrt, no rush on my side (also I think the error is something on my end or with TS, will report back if I manage to fix)