jordan
jordan
Explore posts from servers
CDCloudflare Developers
Created by jordan on 8/7/2024 in #pages-help
Remix and Vite - 2 error(s) and 0 warning(s) when compiling Worker.
I am trying to use pages for the first time and having an issue when trying to deploy. Working locally, everything works as expected but when building and running I get the error: 2 error(s) and 0 warning(s) when compiling Worker. This is for:
10:06:22.426 ✘ [ERROR] Could not resolve "crypto"
10:06:22.426
10:06:22.426 ../node_modules/cookie-signature/index.js:5:21:
10:06:22.426 ✘ [ERROR] Could not resolve "crypto"
10:06:22.426
10:06:22.426 ../node_modules/cookie-signature/index.js:5:21:
and:
10:06:22.428 ✘ [ERROR] Could not resolve "stream"
10:06:22.428
10:06:22.428 ../node_modules/stream-slice/index.js:3:24:
10:06:22.428 ✘ [ERROR] Could not resolve "stream"
10:06:22.428
10:06:22.428 ../node_modules/stream-slice/index.js:3:24:
I am using the template provided by Cloudflare, I have added the compatibility flag "nodejs_compat" and this is my dependencies:
"dependencies": {
"@heroicons/react": "^2.1.5",
"@prisma/client": "^5.17.0",
"@remix-run/cloudflare": "^2.10.3",
"@remix-run/cloudflare-pages": "^2.10.3",
"@remix-run/react": "^2.10.3",
"@tailwindcss/forms": "^0.5.7",
"bcryptjs": "^2.4.3",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remix-auth": "^3.7.0",
"remix-auth-form": "^1.5.0"
},
"dependencies": {
"@heroicons/react": "^2.1.5",
"@prisma/client": "^5.17.0",
"@remix-run/cloudflare": "^2.10.3",
"@remix-run/cloudflare-pages": "^2.10.3",
"@remix-run/react": "^2.10.3",
"@tailwindcss/forms": "^0.5.7",
"bcryptjs": "^2.4.3",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remix-auth": "^3.7.0",
"remix-auth-form": "^1.5.0"
},
I'm not sure how to fix this, as the guidance seems to be setting your compatibility flag, which I have done in wrangler.toml: compatibility_flags = [ "nodejs_compat" ] Any help would be appreciated!
5 replies