See: lodash/lodash#5862
Lodash uses Function(String)
which upsets Next.js and is incompatible with CloudFlare workers (Vercel Edge), resulting in errors like:
Failed to compile.
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
Apply those patches to work around the issue. Tested with Lodash 3.0.1
.
- Copy files into your project, i.e. under
patches/
- For Bun use
patcheer
: oven-sh/bun#2336 (comment) - For Npm and Yarn, use
patch-package
: https://www.npmjs.com/package/patch-package