diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index ceef400e9f3b19..1804b589ceb3ed 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -54,7 +54,8 @@ When importing a ESM only package by `require`, the following error happens. > Failed to resolve "foo". This package is ESM only but it was tried to load by `require`. -> "foo" resolved to an ESM file. ESM file cannot be loaded by `require`. +> Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/dependency.js from /path/to/vite.config.js not supported. +> Instead change the require of index.js in /path/to/vite.config.js to a dynamic import() which is available in all CommonJS modules. In Node.js <=22, ESM files cannot be loaded by [`require`](https://nodejs.org/docs/latest-v22.x/api/esm.html#require) by default.