s2 is not a function on pnpx wrangler deploy

I'm running pnpx wrangler deploy with the following wrangler.toml to deploy a Nuxt 3 application from Windows 11. Everything was working perfectly fine yesterday. I haven't found anything on google, in this discord, or as a Github issue. Wrangler.toml:
name = "frontend-nuxt"
main = "./.output/server/index.mjs"
workers_dev = true
compatibility_date = "2023-11-12"
account_id = "REDACTED"
route = "REDACTED"

rules = [
{ type = "ESModule", globs = ["**/*.js", "**/*.mjs"]},
]

[site]
bucket = ".output/public"

[env.production]
route="REDACTED"

[vars]
BACKEND_DOMAIN="REDACTED"
name = "frontend-nuxt"
main = "./.output/server/index.mjs"
workers_dev = true
compatibility_date = "2023-11-12"
account_id = "REDACTED"
route = "REDACTED"

rules = [
{ type = "ESModule", globs = ["**/*.js", "**/*.mjs"]},
]

[site]
bucket = ".output/public"

[env.production]
route="REDACTED"

[vars]
BACKEND_DOMAIN="REDACTED"
Error:
X [ERROR] A request to the Cloudflare API (/accounts/REDACTED/workers/scripts/frontend-nuxt) failed.

Uncaught TypeError: s2 is not a function
at worker.js:27540:16
at worker.js:27542:6
at worker.js:33657:4
at worker.js:33658:3
[code: 10021]
X [ERROR] A request to the Cloudflare API (/accounts/REDACTED/workers/scripts/frontend-nuxt) failed.

Uncaught TypeError: s2 is not a function
at worker.js:27540:16
at worker.js:27542:6
at worker.js:33657:4
at worker.js:33658:3
[code: 10021]
2 Replies
Bobakanoosh
Bobakanoosh7mo ago
Narrowed it down to a single commit.. If I do: import { parseISO, formatDistanceToNowStrict } from "date-fns"; it fails, but import { parseISO, formatDistanceToNowStrict } from "date-fns/esm"; (date-fns/esm vs date-fns) works....
Bobakanoosh
Bobakanoosh7mo ago
For anyone else who gets this.. https://github.com/date-fns/date-fns/issues/1781
GitHub
Node.js ESM support · Issue #1781 · date-fns/date-fns
Unfortunately, Node.js didn't add support for "module" field that is supported by bundlers such as webpack, and introduced their own resolve logic. To add Node.js ESM support instead ...