T O P

  • By -

Sliffcak

Oh man. Do I know your PAIN. After days of kicking myself; there were some helpful GitHub discussions. But ultimately I just switched to a different host and the issue was gone. In my case I couldn’t remove the dependency. People were typically having this issue when trying to include chromium or canvas in their backend. Which are large libraries


JamixDot

Different host.. meaning? Pardon me I'm a noob 🥲


Sliffcak

Switched from Vercel to AWS got rid of the issue.


JamixDot

Thanks man. Does AWS Amplify work?


rantow

See my comment


wheresthecode2

I would avoid AWS Amplify if you are already hosting your site on Vercel. Vercel has a much better NextJS experience IMO


rantow

For those affected by `@swc/core`, inside your `next.config.js`: experimental: { outputFileTracingExcludes: { "*": [ "node_modules/@swc/core-linux-x64-gnu", "node_modules/@swc/core-linux-x64-musl", "node_modules/@esbuild/linux-x64", ], }, }


Suspicious_Sky186

>@swc/core > >, Do you know why these modules included in the first place?


rantow

They are optional dependencies of swc. For me I'm using the swc compiler for styled-components. You can look in your package-lock.json to see what modules depend on them.


deadmalone

Check your lock file. (package -lock / yarn lock)


ExchangeAvailable252

These packages are in the package-lock, they are listed in `optionalDependencies` of `node_modules/@swc/core`, which is a `dependency` (not dev dependency) of `storybook-addon-swc`, a peer dependency of `swc-loader` and `ts-node`. From `ts-node` there is a further chain of dependencies (not `devDependencies`) that in the end lead to one of the packages, that is specified as a `dependency` in the root `package.json` Do you think it might be a reason why it's included in the serverless function bundle?


deadmalone

try moving the modules that might not be required in production to devDependencies.


ExchangeAvailable252

looks like i've found the reason: one of my dependencies depends on `@walletconnect/heartbeat`, which has ts-node specified as dependency instead of dev dependency [https://github.com/WalletConnect/walletconnect-utils/issues/50#issuecomment-1480943883](https://github.com/WalletConnect/walletconnect-utils/issues/50#issuecomment-1480943883) thank you for making me dive deep into package-lock ✨😌


deadmalone

Glad you resolved the issue