@flarelabs-net/builder

0.0.1 • Public • Published

Next.js builder for Cloudflare

Build your app

  • update the next.config.mjs as follows

    /** @type {import('next').NextConfig} */
    const nextConfig = {
      output: "standalone",
      experimental: {
        serverMinification: false,
      },
    };
    
    export default nextConfig;
  • add the following devDependency to the package.json:

    "node-url": "npm:url@^0.11.4",
    "wrangler": "^3.77.0"
  • Execute npx @flarelabs-net/builder@latest in your app folder

Serve your app

  • 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"]
    workers_dev = true
    minify = false
    
    # Use the new Workers + Assets to host the static frontend files
    experimental_assets = { directory = ".worker-next/assets", binding = "ASSETS" }
  • Use wrangler dev

Package Sidebar

Install

npm i @flarelabs-net/builder

Weekly Downloads

158

Version

0.0.1

License

MIT

Unpacked Size

225 kB

Total Files

9

Last publish

Collaborators

  • victorb
  • wrangler-publisher
  • petebd
  • dario.piotrowicz
  • jamesopstad
  • igorminar