nodejs_compat still not working as documented
# pages-help
r
I added the nodejs_compat flag in the functions settings both envs, but builds still fail. The issue comes from authjs, which uses those node libraries. I really want to stay with cloudflare over vercel https://developers.cloudflare.com/workers/runtime-apis/nodejs/#enable-nodejs-from-the-cloudflare-dashboard suggests that those nodejs packages should work, yet they aren't. any help?
Copy code
> Using @sveltejs/adapter-cloudflare
21:38:26.511    ✘ [ERROR] Could not resolve "crypto"
21:38:26.512    
21:38:26.512        .svelte-kit/output/server/chunks/hooks.server.js:4:26:
21:38:26.513          4 │ import * as crypto$1 from "crypto";
21:38:26.513            ╵                           ~~~~~~~~
21:38:26.513    
21:38:26.513      The package "crypto" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.514    
21:38:26.516    ✘ [ERROR] Could not resolve "node:buffer"
21:38:26.517    
21:38:26.517        .svelte-kit/output/server/chunks/hooks.server.js:6:23:
21:38:26.517          6 │ import { Buffer } from "node:buffer";
21:38:26.517            ╵                        ~~~~~~~~~~~~~
21:38:26.517    
21:38:26.517      The package "node:buffer" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
21:38:26.517    

...

21:38:26.532    error during build:
21:38:26.532    Error: Build failed with 4 errors:
21:38:26.532    .svelte-kit/output/server/chunks/hooks.server.js:4:26: ERROR: Could not resolve "crypto"
21:38:26.532    .svelte-kit/output/server/chunks/hooks.server.js:6:23: ERROR: Could not resolve "node:buffer"
21:38:26.532    .svelte-kit/output/server/chunks/hooks.server.js:7:26: ERROR: Could not resolve "node:crypto"
21:38:26.532    .svelte-kit/output/server/chunks/hooks.server.js:9:22: ERROR: Could not resolve "node:util"
k
That’s an issue with Svelte’s esbuild usage in their adapter.