{"id":445,"hash":"e2eab5c6d625c50a31ac86daa344d3b0b78a23a328611f1988a0d528e53e83f6","pattern":"The CJS build of Vite&#39;s Node API is deprecated","full_message":"I get a warning when I run vite build (Vite 5)\n\nThe CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.\n\nOn the linked page it says\n\nIf 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:\n\nBut 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:\n\nVITE_CJS_TRACE=true vite build\nVITE_CJS_TRACE' is not recognized as an internal or external command","ecosystem":"npm","package_name":"vite","package_version":null,"solution":"If you use JS then change the vite.config.js file name to vite.config.mjs\n\nSimilarly, if you use TS change the file name to vite.config.mts instead of vite.config.ts\n\nOR\nSet \"type\": \"module\" on package.json file\n\nFor more details read the vite documentation from here","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/77538589/the-cjs-build-of-vites-node-api-is-deprecated","votes":41,"created_at":"2026-04-19T04:51:09.961062+00:00","updated_at":"2026-04-19T04:51:09.961062+00:00"}