tip minersTip Miners

Change deploy target to Cloudflare workers on Remix

change remix app to be deployed to Cloudflare workersWritten by Miguel

The trick to getting this done easily is to create a new project with Remix CLI selecting Cloudflare workers and copy your entire app folder from your original project to the one you just created

Steps

  1. Create a new project with remix CLI: 
    npx create-remix@latest mycloudflareworkersapp
  2. Select Cloudflare workers on the question Where do you want to deploy?
  3. Backup app/entry.client.tsx on a notepad
  4. Copy and replace your app folder from your original remix project
  5. Replace app/entry.client.tsx with the content of the backup on your notepad , here you must be careful to not omit any customization from your original project.
  6. Replace all the @remix-run/node ( or @remix-run/deno ) with @remix-run/cloudflare
  7. If you use process.env you need to migrate them to the cloudflare workers way adding them on the vars section of your wrangler.toml
  8. Enyoy!!

Don’t forget to backup your entry.client.ts from the generated project on cloudflare workers

More articles of Web Development

Idiomatic Application

And .. What is an idiomatic application?

Headless Worpress with Remix JS on Cloudflare

WordPress Headless CMS with Remix JS for Free

adding google analytics script  or GTM on your Remix JS app is a matter of adding it with JSX in a  dangerouslySetInnerHTML attribute

How to add google analytics to a Remix Run Web App