-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
createLucideIcon
from lucite-react
not working from v13.4.13-canary.5
#53605
Comments
I can see this too for
This icon is an alias to This icon is re-exported from dist/esm/lucide-react.mjs, but it does not exist as a standalone import. export { default as LucidePanelLeftOpen, default as LucideSidebarOpen, default as PanelLeftOpen, default as PanelLeftOpenIcon, default as SidebarOpen, default as SidebarOpenIcon } from './icons/panel-left-open.mjs'; As a workaround, I replaced |
Also, import { icons } from "lucide-react"; doesn't work either. Tested with |
Having the same problem for anything i import from lucide-react |
Downgrading to |
thanks @kartikk-k it works to me |
thanks @kartikk-k !!! |
It didn't fix the issue for me Anyone has a clue why lucide-react even does that? |
@JimmyMalark can you share package.json |
@kartikk-k Here you go mate {
"name": "next-template",
"version": "0.0.2",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
"preview": "next build && next start",
"typecheck": "tsc --noEmit",
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache"
},
"dependencies": {
"@radix-ui/react-slot": "^1.0.2",
"class-variance-authority": "^0.4.0",
"clsx": "^1.2.1",
"lucide-react": "0.105.0-alpha.4",
"next": "^13.4.13",
"next-themes": "^0.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sharp": "^0.31.3",
"tailwind-merge": "^1.13.2",
"tailwindcss-animate": "^1.0.6"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^3.7.2",
"@types/node": "^17.0.45",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@typescript-eslint/parser": "^5.61.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.44.0",
"eslint-config-next": "13.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-tailwindcss": "^3.13.0",
"postcss": "^8.4.24",
"prettier": "^2.8.8",
"tailwindcss": "^3.3.2",
"typescript": "^4.9.5"
}
} I'm actually using the latest next template from shadcn/ui |
change
|
Ok it worked but now there's this good old question of "Why it worked?" 😅 Thank you |
if you don't wanna downgrade next, you can just specify the path to |
thanks sukalov this worked for me |
I have changed "next": "13.4.13" to "next": "13.4.12", remove node_modules and run npm i or pnpm i |
seems to be working fine "lucide-react": "0.263.1", |
Confirmed changing |
thanks! I had exactly the same problem, but with this version it has been solved. |
For anyone wondering, the transform for aliased icons was done in this PR (which was based on 0.263.1). The PR description mentions looking for a way to automate this in the future. |
import { whatever } from "../node_modules/lucide-react"; worked for me |
Doing So I patch the next package instead. diff --git a/dist/server/config.js b/dist/server/config.js
index 4891e52fa02c90fc6228f0ebc1079e0172addd14..befdf22e0ab38b5a087a8b8744e2dc7cb324a5a2 100644
--- a/dist/server/config.js
+++ b/dist/server/config.js
@@ -490,6 +490,7 @@ function assignDefaults(dir, userConfig, silent = false) {
"(Edit2|LucideEdit2|Edit2Icon)": "modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/pen!lucide-react",
"(Stars|LucideStars|StarsIcon)": "modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/sparkles!lucide-react",
"(TextSelection|LucideTextSelection|TextSelectionIcon)": "modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/text-select!lucide-react",
+ "(createLucideIcon)": "modularize-import-loader?name={{ member }}&from=default&as=default&join=./createLucideIcon!lucide-react",
// General rules
"Lucide(.*)": "modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/{{ kebabCase memberMatches.[1] }}!lucide-react",
"(.*)Icon": "modularize-import-loader?name={{ member }}&from=default&as=default&join=./icons/{{ kebabCase memberMatches.[1] }}!lucide-react", |
Same issue with me trying to add shopping bag icon but getting error. import { ShoppingBag } from 'lucide-react' but when importing using absolute path "../node_modules/lucide-react" its working |
One can just say many, if not most, features of |
description of issue vercel/next.js#53605
I will recommend you use this path for the 'lucide-react' module as the latest version is still being worked on. |
Thank you for the recommendation. I've tried various methods to resolve the issue with the lucide-react module, but unfortunately, none of them have worked for me. I'll give your suggested path a try and see if it resolves the problem. I appreciate your assistance! |
not good |
|
…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.
I am on next version 13.4.19 and I still have this issue |
@max-programming Yeah because the fix here hasn’t landed in the stable channel yet. It works fine in canary now. |
@max-programming In other words, will be fixed in 13.4.20. |
works with |
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. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.0.0: Tue Jul 18 20:35:32 PDT 2023; root:xnu-10002.0.199.505.1~3/RELEASE_ARM64_T8112 Binaries: Node: 20.3.1 npm: 9.6.7 Yarn: 1.22.19 pnpm: 8.6.11 Relevant Packages: next: 13.4.13-canary.16 eslint-config-next: N/A 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)
App Router
Link to the code that reproduces this issue or a replay of the bug
https://github.com/joulev/debug/tree/nextjs-create-lucide-icon-not-working
To Reproduce
next dev
ornext build
on the reproduction repository.Describe the Bug
Expected Behavior
The icon should work normally.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-1495
The text was updated successfully, but these errors were encountered: