JSPM

  • Created
  • Published
  • Downloads 179466
  • Score
    100M100P100Q184162F
  • License MIT

Cloudflare builder for next apps

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@opennextjs/cloudflare) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Next.js builder for Cloudflare

    How to update a Next.js application to run on Cloudflare.

    Configure your app

    • add the following devDependencies to the package.json:

      pnpm add -D wrangler@latest @opennextjs/cloudflare

    Serve your app

    • build the app and adapt it for Cloudflare

      pnpx cloudflare
    • add a wrangler.toml at the root of your project

      #:schema node_modules/wrangler/config-schema.json
      name = "<app-name>"
      main = ".worker-next/index.mjs"
      
      compatibility_date = "2024-08-29"
      compatibility_flags = ["nodejs_compat_v2"]
      
      # Use the new Workers + Assets to host the static frontend files
      experimental_assets = { directory = ".worker-next/assets", binding = "ASSETS" }
    • Preview the app in Wrangler

      pnpm wrangler dev