Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Named export 'mapValues' not found. The requested module 'lodash' is a CommonJS module #6044

Closed
riyaz-binit-ai opened this issue Jun 12, 2024 · 4 comments · Fixed by #6052, #6058 or #6105
Assignees
Labels
bug Something isn't working
Milestone

Comments

@riyaz-binit-ai
Copy link

Describe the bug

I'm using the nextJS frontend environment and trying to connect my Hasura backend with @refinedev/hasura. However, I've been encountering this issue from the start.

Server Error
SyntaxError: Named export 'mapValues' not found. The requested module 'lodash' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'lodash';
const {id:l},operation:u};let{query:q,variables:o}=E.subscription({operation:u,variables:{id:{value:l,type:"uuid",required:!0},...s.variables},fields:s.fields});return{query:q,variables:o,operation:u}};import Z from"lodash-es/mapKeys.js";import m from"camelcase";var j=n=>{if(n)return Z(n,(s,l)=>m(l))};import{mapValues: ee}from"lodash";var I=n=>{if(n)return ee(n,s=>s.toUpperCase())};import S from"camelcase";import O from"graphql-tag";var se=(n,s)=>{let{idType:l,namingConvention:u="hasura-default"}=s??{},i=u==="hasura-default",q=o=>typeof l=="function"?l(o):l??"uuid";return{getOne:async({resource:o,id:p,meta:e})=>{let r=i?${(e==null?void 0:e.operation)??o}_by_pk:g(${(e==null?void 0:e.operation)??o}_by_pk),t=S(r,{pascalCase:!0}),a=(e==null?void 0:e.gqlQuery)??(e==null?void 0:e.gqlMutation);if(a){let f=a,_={id:p} = pkg;

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack

file:///Users/riyaz/Projects/Binit/portal/node_modules/@refinedev/hasura/dist/index.mjs (21)

Steps To Reproduce

Just create a client with @refinedev/hasura

Expected behavior

--

Packages

  • @refinedev/hasura

Additional Context

No response

@riyaz-binit-ai riyaz-binit-ai added the bug Something isn't working label Jun 12, 2024
@BatuhanW
Copy link
Member

Hey @riyaz-binit-ai can you provide a minimal reproducible example? It's not helping if you don't provide as much as details possible, such as versions of the packages.

@riyaz-binit-ai
Copy link
Author

Hey @BatuhanW, Thanks for your quick response. I have installed the latest version of @refinedev/hasura (v6.6.4) and created a data provider from it. When I used the data provider in my application, it caused the above issue. However, after downgrading the package to @refinedev/[email protected], everything is now working fine without any issues. It seems that the issue is only occurring in the latest version.

@BatuhanW
Copy link
Member

Hey @riyaz-binit-ai thanks for the report and details! @aliemir already raised a PR for this one. It will be release in the next release cycle.

@riyaz-animeta
Copy link

Great 🙌 @BatuhanW @aliemir

@omeraplak omeraplak added this to the July Release milestone Jun 21, 2024
@omeraplak omeraplak linked a pull request Jun 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants