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

Error resolving EcmaScript Modules request (icons from the library stopped working after the update) #54063

Closed
1 task done
MrOxMasTer opened this issue Aug 15, 2023 · 4 comments · Fixed by #54572
Closed
1 task done
Labels
bug Issue was opened via the bug report template. locked

Comments

@MrOxMasTer
Copy link

Verify canary release

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

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.17.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.15
      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


warn  - Latest canary version not detected, detected: "13.4.15", newest: "13.4.16".
        Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
        Read more - https://nextjs.org/docs/messages/opening-an-issue

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

No response

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

/sdssdsdd

To Reproduce

/ssssdssdsdsd

Describe the Bug

I use the shadcn ui library. It in turn uses radix/ui and lucide-react. When connecting icons from lucide, I get an error after upgrading to version 13.4.15-13.4.16. Before that, there was version 13.4.11 and everything was fine and I wanted to update and I started getting an error when connecting icons from the lucide-react library
image
image
image
image
image

Expected Behavior

work

Which browser are you using? (if relevant)

chrome

How are you deploying your application? (if relevant)

No response

@MrOxMasTer MrOxMasTer added the bug Issue was opened via the bug report template. label Aug 15, 2023
@MrOxMasTer
Copy link
Author

13.4.13 also does not work on this version. Only on 13.4.12 and earlier

@MrOxMasTer
Copy link
Author

lucide-icons/lucide#1482

@rossanmol
Copy link

Still broken :/

shuding added a commit that referenced this issue Aug 25, 2023
…ig (#54572)

## Implementation

Base on #54530, we're implementing a `optimize_barrel` transform to
optimize barrel files to only export the names we need. If the
transformed file isn't a "barrel file", we just re-export the names from
it without any transformation.

Take `lucide-react` as an example, with #54530 we are able to transform

```js
import { IceCream } from 'lucide-react'
```

to 

```js
import { IceCream } from '__barrel_optimize__?names=IceCream!=!lucide-react?__barrel_optimize_noop__=IceCream'
```

And then, we apply that new request with a new Webpack module rule to
use the SWC loader with option `optimizeBarrelExports: ['IceCream']`,
which eventually got passed to this new `optimize_barrel` transform and
does the optimization.

## Notes

We'll have to add a new `getModularizeImportAliases` alias list to map
`lucide-react` to the ESM version, as we have the `['main', 'module']`
resolve order for the server compiler. Otherwise this optimization
doesn't work in that compiler.

There's no e2e test added because it's already covered by the
`modularize-imports` test as we removed the default `lucide-react`
transform rules and it still works.

We'll need to test other libs before migrating them to the new
`optimizePackageImports` option.

---

Closes #54571, closes #53605, closes #53789, closes #53894, closes
#54063.
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2023

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 added the locked label Sep 9, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 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. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants