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

Tests fails when lucide-react is used with Next 13.4.13 #53668

Closed
1 task done
edenstrom opened this issue Aug 7, 2023 · 13 comments
Closed
1 task done

Tests fails when lucide-react is used with Next 13.4.13 #53668

edenstrom opened this issue Aug 7, 2023 · 13 comments
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked Testing Related to testing with Next.js.

Comments

@edenstrom
Copy link

edenstrom commented Aug 7, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: 1.22.19
      pnpm: 8.3.1
    Relevant Packages:
      next: 13.4.13
      eslint-config-next: 13.4.12
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

Jest (next/jest)

Link to the code that reproduces this issue or a replay of the bug

https://github.com/edenstrom/nextjs-bug-reproduction

To Reproduce

Relevant code in example above:

  • src/app/component.tsx
  • src/app/component.test.tsx
  1. Run pnpm test or jest to run tests.
  2. Tests will fail with error below:
 FAIL  src/app/component.test.tsx
  ● Test suite failed to run

    Cannot find module 'modularize-import-loader?name=Check&from=default&as=default&join=./icons/check!lucide-react' from 'src/app/component.tsx'

    Require stack:
      src/app/component.tsx
      src/app/component.test.tsx



      at Resolver._throwModNotFoundError (node_modules/.pnpm/[email protected]/node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (src/app/component.tsx:12:66)
      at Object.<anonymous> (src/app/component.test.tsx:7:20)

Test Suites: 1 failed, 1 total
  1. Output works in browser with next dev and shows icon correctly
  2. Change version of Next to 13.4.12. This makes the tests work again.

Describe the Bug

Usage of lucide-react with Next.js 13.4.13 crashes the tests.

Version Tests works
13.4.13
13.4.13-canary.18
13.4.12

Expected Behavior

Module should correctly resolve and the tests should succeed.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1494

@edenstrom edenstrom added the bug Issue was opened via the bug report template. label Aug 7, 2023
@github-actions github-actions bot added the Testing Related to testing with Next.js. label Aug 7, 2023
@balazsorban44 balazsorban44 added the linear: next Confirmed issue that is tracked by the Next.js team. label Aug 7, 2023
@balazsorban44
Copy link
Member

Looks like #53051 has not addressed some imports correctly, we will look into this!

@syntaxlexx
Copy link

Any workaround in the meantime?

@benrandja-akram
Copy link

Any workaround in the meantime?

@syntaxlexx try

 "lucide-react": "0.263.1",

@JefteMedeiros
Copy link

Same problem here, rolled back to 13.4.12

@balazsorban44
Copy link
Member

This was fixed in #53697, so closing. You can upgrade to next@canary to test it out, and it will be available shortly on next@latest too!

@kremalicious
Copy link

kremalicious commented Aug 16, 2023

this is not solved for me when using Next.js v13.4.16 and lucide-react v0.268.0. While solved during build runs, I am still getting this when doing any test run with Jest:

Cannot find module 'modularize-import-loader?name=ArrowDownCircle&from=default&as=default&join=../esm/icons/arrow-down-circle!lucide-react' from ...

Reproducible with originally mentioned test case, but with upgraded Next.js: https://github.com/edenstrom/nextjs-bug-reproduction

venables added a commit to startkit-dev/startkit-next that referenced this issue Aug 16, 2023
The latest versions of next and lucide-react do not play nicely with our
jest configuration. So for the time being, we remove the tests that
involved importing an icon, specifically the page.test.tsx file, which
largely existed as an example test file.

This issue was closed, but is still an issue: vercel/next.js#53668
@iarlen-reis
Copy link

isso não foi resolvido para mim ao usar o Next.js v13.4.16 e o lucide-react v0.268.0. Enquanto resolvido durante as execuções de compilação, ainda estou conseguindo isso ao fazer qualquer teste com o Jest:

Cannot find module 'modularize-import-loader?name=ArrowDownCircle&from=default&as=default&join=../esm/icons/arrow-down-circle!lucide-react' from ...

Reprodutível com o caso de teste mencionado originalmente, mas com Next.js atualizado: https://github.com/edenstrom/nextjs-bug-reproduction

go back to the previous version of nextjs: "next": "^13.4.12".

npm install [email protected]

@msquinn
Copy link

msquinn commented Aug 28, 2023

Still running into this issue with next: 13.4.19 and lucide-react: 0.269.0

@max-programming
Copy link
Contributor

Same here @msquinn

@steezplusplus
Copy link

Me as well

@joaopedrodcf
Copy link

This combination works to run jest tests:

lucide-react: 0.269.1

next: 13.4.20-canary.28

It seems the problem stopped appearing from this version onwards: 13.4.20-canary.9

@steezplusplus
Copy link

Works with

"next": "13.4.20-canary.28"
"lucide-react": "^0.277.0"

steezplusplus added a commit to steezplusplus/digital-garden that referenced this issue Sep 14, 2023
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked Testing Related to testing with Next.js.
Projects
None yet
Development

No branches or pull requests