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: Next.js Support - ERR_UNSUPPORTED_DIR_IMPORT #124

Closed
doktordos-eth opened this issue Oct 20, 2023 · 1 comment
Closed

Bug: Next.js Support - ERR_UNSUPPORTED_DIR_IMPORT #124

doktordos-eth opened this issue Oct 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@doktordos-eth
Copy link
Contributor

Describe the bug

@xmtp/react-sdk throws the follwing error in the console when executing "yarn dev" and the application gets stuck there:

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/doktordos/Developer/ensvision/node_modules/date-fns/min' is not supported resolving ES modules imported from /Users/doktordos/Developer/ensvision/node_modules/@xmtp/react-sdk/lib/index.js
Did you mean to import date-fns/min/index.js?

I tried changing the imports in node_modules/@xmtp/react-sdk as follows:
/node_modules/@xmtp/react-sdk/lib/index.js

Lines 10-11:

import Gt from 'date-fns/min';
import $t from 'date-fns/subSeconds';

to:

import { min as Gt} from 'date-fns';
import { subSeconds as $t} from 'date-fns';

and afterwards all works as expected.

Could you please change the following imports so the package will work out of the box on next.js:
0b215a6

Expected behavior

See above.

Steps to reproduce the bug

Installed package @xmtp/react-sdk in next.js project via yarn add @xmtp/react-sdk throws above mentioned error in console.

@doktordos-eth doktordos-eth added the bug Something isn't working label Oct 20, 2023
@doktordos-eth
Copy link
Contributor Author

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
Development

No branches or pull requests

1 participant