I try to bundle react code in a nextjs api using esbuild. It works on local fine but not in production.
Here is my serverComponentsExternalPackages configuration.
experimental: {
serverComponentsExternalPackages: [
"esbuild",
"@tremor/react",
"lucide-react",
]
},
I print node_modules in api call on production (it is hosted on vercel).
it adds ‘esbuild’ in there but not ‘lucide-react’ or any other packages.
Binaries:
Node: 21.1.0
npm: 10.2.0
Relevant packages:
next: 14.1.1
react: 18.2.0
react-dom: 18.2.0
typescript: 5.0.4
It there any solution/workaround for this issue?
I tried adding them by webpack config or transpilePackages but neither worked.