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

use-sync-external-store causes ERR_UNSUPPORTED_DIR_IMPORT error #1754

Closed
1 of 3 tasks
p-j opened this issue Aug 30, 2023 · 4 comments · Fixed by #1755
Closed
1 of 3 tasks

use-sync-external-store causes ERR_UNSUPPORTED_DIR_IMPORT error #1754

p-j opened this issue Aug 30, 2023 · 4 comments · Fixed by #1755

Comments

@p-j
Copy link

p-j commented Aug 30, 2023

Describe the bug
After upgrading from 4.3.0 to 4.4.1 the build of our Next.js app started failing with the following error:

unhandledRejection Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '<...>/node_modules/use-sync-external-store/shim' is not supported resolving ES modules imported from <...>/node_modules/@lingui/react/dist/index.mjs
Did you mean to import use-sync-external-store/shim/index.js?
    at new NodeError (node:internal/errors:399:5)
    at finalizeResolution (node:internal/modules/esm/resolve:319:17)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  type: 'Error',
  code: 'ERR_UNSUPPORTED_DIR_IMPORT',
  url: 'file://<...>/node_modules/use-sync-external-store/shim'
}

Additional context

  • jsLingui version 4.4.1
  • Babel version 7.22.11
  • Macro support:
  • I'm using SWC with @lingui/swc-plugin
  • I'm using Babel with babel-macro-plugin
  • I'm not using macro

Might be related to facebook/react#26230

Is there something we should do on our end to make it work?

@andrii-bodnar
Copy link
Contributor

@vonovak could you please take a look?

@usercao
Copy link

usercao commented Aug 30, 2023

image
@vonovak As long as you upgrade to version 4.4.1 this error will be reported immediately and it is no longer usable.

@vonovak
Copy link
Collaborator

vonovak commented Aug 30, 2023

Hi!
I'm going to take a look in a few hours, I'm afk now.
Can someone confirm if the suggested import change fixes the issue in nextjs?

@vonovak
Copy link
Collaborator

vonovak commented Aug 31, 2023

hi! I opened a PR that reverts the change. For now that seems the best option #1755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants