Does serverless function supports require-ESM on Node 22? In this blog post, it mentions “added support for require()ing synchronous ESM module graphs”. However, it doesn’t work in my deployment.
Current behavior
When I require an ESM-only library, e.g. uuid, Node throws ERR_REQUIRE_ESM.
Expected behavior
Node doesn’t throw when requiring an ESM-only library.
Code
Repository: https://github.com/alvinleung1996/vercel-node22-require-esm-test
Steps to reproduce
- Install Node 22.18.0.
- Run
yarn install. - Run
vercel dev. - Open
http://localhost:3000 - "require('uuid') error" should be "null".
- Run
vercel deploy. - "require('uuid') error" is "Error [ERR_REQUIRE_ESM]...".
Project information
Deployment: https://vercel-node22-require-esm-test.vercel.app Node.js Version: 22.x


