rahrang
CDCloudflare Developers
•Created by Acro on 12/27/2023 in #pages-help
Cloudflare Pages + TurboRepo + PNPM
I've got this same issue right now when trying to deploy a Remix app to Cloudflare Pages and I'm stuck between two options which both don't work. I'm also on Build System Version 2.
Option 1:
- Build output directory:
apps/my-remix-app/public
- Root directory: /
(the root of the monorepo)
Cloudflare Pages correctly uses pnpm
to install dependencies and then deploys my app using the specified build directory, but the app doesn't work because the /functions
directory (which Remix needs to actually be able to serve the app) isn't found because Cloudflare Pages is looking for it at /functions
instead of apps/my-remix-app/functions
.
Option 2:
- Build output directory: /public
- Root directory: /apps/my-remix-app
Cloudflare Pages incorrectly uses npm
to install dependencies, which doesn't work because apps/my-remix-app/package.json
has dependencies on other packages in my workspace
which npm
can't resolve because workspace:*
is pnpm
syntax.
Suggested solution
Cloudflare Pages should use the packageManager
property in the root directory's package.json
to determine which package manager to use (in my case, that property looks like "packageManager": "[email protected]"
), and if that property isn't set, use whatever logic currently exists to determine which package manager to use.27 replies