diff --git a/.changeset/bright-chicken-learn.md b/.changeset/bright-chicken-learn.md new file mode 100644 index 0000000000..3995e5f80b --- /dev/null +++ b/.changeset/bright-chicken-learn.md @@ -0,0 +1,5 @@ +--- +"react-email": patch +--- + +use the `punycode` package for the static modules diff --git a/packages/react-email/module-punycode.d.ts b/packages/react-email/module-punycode.d.ts new file mode 100644 index 0000000000..ca2baa2430 --- /dev/null +++ b/packages/react-email/module-punycode.d.ts @@ -0,0 +1,3 @@ +declare module 'module-punycode' { + export * from 'node:punycode'; +} diff --git a/packages/react-email/next-env.d.ts b/packages/react-email/next-env.d.ts index 40c3d68096..1b3be0840f 100644 --- a/packages/react-email/next-env.d.ts +++ b/packages/react-email/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/packages/react-email/package.json b/packages/react-email/package.json index 7d22b1fc92..d1c7575c52 100644 --- a/packages/react-email/package.json +++ b/packages/react-email/package.json @@ -68,6 +68,7 @@ "framer-motion": "12.0.0-alpha.2", "postcss": "8.4.40", "prism-react-renderer": "2.1.0", + "module-punycode": "npm:punycode@2.3.1", "react": "^19", "react-dom": "^19", "sharp": "0.33.3", diff --git a/packages/react-email/src/utils/static-node-modules-for-vm.ts b/packages/react-email/src/utils/static-node-modules-for-vm.ts index 9abc00b345..9751fbcf40 100644 --- a/packages/react-email/src/utils/static-node-modules-for-vm.ts +++ b/packages/react-email/src/utils/static-node-modules-for-vm.ts @@ -23,7 +23,6 @@ import os from 'node:os'; import path from 'node:path'; import perfHooks from 'node:perf_hooks'; import process from 'node:process'; -import punycode from 'node:punycode'; import querystring from 'node:querystring'; import readline from 'node:readline'; import repl from 'node:repl'; @@ -40,6 +39,8 @@ import v8 from 'node:v8'; import vm from 'node:vm'; import workerThreads from 'node:worker_threads'; import zlib from 'node:zlib'; +// See https://github.com/resend/react-email/issues/1841#issuecomment-2589985562 +import punycode from 'module-punycode'; /** * A map of the name of the modules (including `node:` prefixed ones) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 64a2441d88..998e71c5b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1066,6 +1066,9 @@ importers: framer-motion: specifier: 12.0.0-alpha.2 version: 12.0.0-alpha.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + module-punycode: + specifier: npm:punycode@2.3.1 + version: punycode@2.3.1 postcss: specifier: 8.4.40 version: 8.4.40