npmvite95% confidence\u2191 41

The CJS build of Vite's Node API is deprecated

Full error message
I get a warning when I run vite build (Vite 5)

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

On the linked page it says

If you're unsure where the warning is coming from, you can run your script with the VITE_CJS_TRACE=true flag to log the stack trace:

But how do I do that? I tried adding that to my script like this     "build": "VITE_CJS_TRACE=true vite build",, but that gives me an error:

VITE_CJS_TRACE=true vite build
VITE_CJS_TRACE' is not recognized as an internal or external command

If you use JS then change the vite.config.js file name to vite.config.mjs Similarly, if you use TS change the file name to vite.config.mts instead of vite.config.ts OR Set "type": "module" on package.json file For more details read the vite documentation from here

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/e2eab5c6d625c50a31ac86daa344d3b0b78a23a328611f1988a0d528e53e83f6
hash \u00b7 e2eab5c6d625c50a31ac86daa344d3b0b78a23a328611f1988a0d528e53e83f6
The CJS build of Vite's Node API is deprecated — DepScope fix | DepScope