opennextjs / opennextjs-cloudflare

Open Next.js adapter for Cloudflare
https://opennext.js.org/cloudflare
MIT License
378 stars 8 forks source link

[BUG] Deploy size exceeds 1MiB #132

Closed DenizUgur closed 6 days ago

DenizUgur commented 6 days ago

Describe the bug

I've followed the guide on the OpenNext page and ran the following command to set up a project. I'm on a Workers Free plan, so I'd understand some limitations, but if it's impossible to deploy a simple page, what's the point of a free plan?

npm create cloudflare@latest -- my-next-app --framework=next --experimental

If I deploy this to Cloudflare, it complains that the Worker size exceeds 1MiB.

Asset output:

Details

``` 🌀 Found 30 new or modified static assets to upload. Proceeding with upload... + /_next/static/bbABHT9gP3a3ON8d2aHN4/_ssgManifest.js + /_next/static/bbABHT9gP3a3ON8d2aHN4/_buildManifest.js + /_next/static/chunks/pages/_app-6a626577ffa902a4.js + /vercel.svg + /_next/static/chunks/webpack-d0ceac4fb78a3613.js + /_next/static/media/97e0cb1ae144a2a9-s.woff2 + /_next/static/css/5e6174dc386106fb.css + /_next/static/media/55c55f0601d81cf3-s.woff2 + /_next/static/media/6d93bde91c0c2823-s.woff2 + /_next/static/chunks/23-b75664ace61c0abb.js + /cdn-cgi/_cf_seed_data/index.meta + /cdn-cgi/_cf_seed_data/favicon.ico.meta + /_next/static/chunks/app/layout-71b70fb6c4fdaf4e.js + /next.svg + /cdn-cgi/_cf_seed_data/index.rsc + /_next/static/chunks/173-32f9ff9bdfb525b3.js + /_next/static/media/26a46d62cd723877-s.woff2 + /cdn-cgi/_cf_seed_data/favicon.ico.body + /_next/static/chunks/polyfills-78c92fac7aa8fdd8.js + /_next/static/chunks/framework-f66176bb897dc684.js + /_next/static/chunks/app/page-e21fe46a02a1a5b7.js + /_next/static/chunks/pages/_error-1be831200e60c5c0.js + /_next/static/chunks/main-app-3ca0283cb01da4f9.js + /_next/static/chunks/app/_not-found/page-05886c10710171db.js + /_next/static/media/df0a9ae256c0569c-s.woff2 + /cdn-cgi/_cf_seed_data/index.html + /_next/static/media/581909926a08bbc8-s.woff2 + /_next/static/media/a34f9d1faa5f3315-s.p.woff2 + /_next/static/chunks/main-c8553ba68b419844.js + /_next/static/chunks/fd9d1056-2821b0f0cabcd8bd.js Uploaded 10 of 30 assets Uploaded 20 of 30 assets Uploaded 30 of 30 assets ✨ Success! Uploaded 30 files (5.22 sec) ```

Warning:

Details

``` Total Upload: 5165.48 KiB / gzip: 1332.80 KiB â–² [WARNING] Here are the 5 largest dependencies included in your script: - node_modules/next/dist/compiled/node-fetch/index.js - 787.75 KiB - .worker-next/index.mjs - 685.51 KiB - node_modules/next/dist/compiled/terser/bundle.min.js - 477.70 KiB - .worker-next/.next/standalone/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js - 336.97 KiB - node_modules/next/dist/compiled/cssnano-simple/index.js - 231.70 KiB If these are unnecessary, consider removing them ```

Steps to reproduce

  1. npm create cloudflare@latest -- my-next-app --framework=next --experimental
  2. npm install
  3. npm run deploy

Expected behavior

Be able to deploy a page in the Workers Free plan.

@opennextjs/cloudflare version

0.2.1

Node.js version

22.11.0

Wrangler version

3.86

next info output

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:37:25 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.12.3
Relevant Packages:
  next: 14.2.5 // An outdated version detected (latest is 15.0.3), upgrade is highly recommended!
  eslint-config-next: 14.2.5
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.3

Additional context

I've also tried to use npm to see if it made any difference, but no.

vicb commented 6 days ago

Duplicate of https://github.com/opennextjs/opennextjs-cloudflare/issues/77