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

Cannot get final name for export 'BarChart4Icon' of __barrel_optimize__ #58756

Closed
1 task done
soymartinez opened this issue Nov 22, 2023 · 4 comments
Closed
1 task done
Assignees
Labels
bug Issue was opened via the bug report template. locked SWC Related to minification/transpilation in Next.js.

Comments

@soymartinez
Copy link

Link to the code that reproduces this issue

https://github.com/omgismartinez/eye/blob/dev/config/site.ts

To Reproduce

  1. Start the build of the application (next build)

Current vs. Expected behavior

It is only an object where it is specified which is the icon that makes reference to the route, the lucide-react library is used.
image

In development it works fine but when building it fails.
image

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 Home  
Binaries:
  Node: 21.2.0
  npm: N/A
  Yarn: N/A
  pnpm: 8.10.5
Relevant Packages:
  next: 14.0.3
  eslint-config-next: 14.0.3
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure, SWC minifier (swcMinify: true), SWC transpilation

Additional context

  1. I tried with version 13.5.x and now with version 14.0.3 but it keeps crashing,
  2. I tried to change the file extension from .ts to .tsx but the error persists.
  3. Change the different icon imports of lucide-react (BarChart4Icon, BarChart4)
  4. The application is deployed in Vercel (error persists)
@soymartinez soymartinez added the bug Issue was opened via the bug report template. label Nov 22, 2023
@github-actions github-actions bot added area: SWC Minify SWC Related to minification/transpilation in Next.js. labels Nov 22, 2023
@frethereeks
Copy link

I found the solution (at least, for me). I had import {IoIosTrendingUp, IoIosCode, IoIosLaptop } from 'react-icons/io which works in development but fails on build.

After much effort, I inspected the folder and file structures of the react-icons library, then, found all the icons were also exported in the index page (also in the index.esm but that isn't useful) and imported the font/icons from it (the index.js page). Short story long, I modified the above import line to import {IoIosTrendingUp, IoIosCode, IoIosLaptop } from 'react-icons/io/index and that solved it for me.

Basically, add "index" after the specific library you are using e.g react-icons/md should be react-icons/md/index. That's all.

@soymartinez
Copy link
Author

For the reference icons to work, it was necessary to specify the "use client" and this way everything worked for me.

@kdy1
Copy link
Member

kdy1 commented Jan 23, 2024

Is this issue still occurring?
I cannot access the repro

@kdy1 kdy1 assigned kdy1 and unassigned kdy1 Jan 23, 2024
@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2024
Copy link
Contributor

github-actions bot commented Feb 6, 2024

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 Feb 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2024
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 SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

No branches or pull requests

3 participants