Skip to content

NextJS static pages with dynamic routes results in oversized server.js #362

@vbudovski

Description

@vbudovski

NextJS compilation target has been set to serverless. Fab builds without issues aside from extremely large server.js in resulting bundle. This prevents a deploy to Cloudflare as there is a 1MB worker size limit.

[…/input-nextjs] Finding all static HTML pages…
[…/input-nextjs] ✔ Found 88 static html pages.
[…/input-nextjs] Reusing NextJS renderer cache frontend/.fab/.cache/generated-nextjs-renderers.049a5d6.js
[…/input-nextjs] Finding all static assets
[…/input-nextjs] ✔ Found 238 assets.
[…/input-nextjs] Finding all public files
[…/input-nextjs]   ✔ android-chrome-192x192.png
[…/input-nextjs]   ✔ android-chrome-512x512.png
[…/input-nextjs]   ✔ apple-touch-icon.png
[…/input-nextjs]   ✔ browserconfig.xml
[…/input-nextjs]   ✔ favicon-16x16.png
[…/input-nextjs]   ✔ favicon-32x32.png
[…/input-nextjs]   ✔ favicon.ico
[…/input-nextjs]   ✔ mstile-144x144.png
[…/input-nextjs]   ✔ mstile-150x150.png
[…/input-nextjs]   ✔ mstile-310x150.png
[…/input-nextjs]   ✔ mstile-310x310.png
[…/input-nextjs]   ✔ mstile-70x70.png
[…/input-nextjs]   ✔ safari-pinned-tab.svg
[…/input-nextjs]   ✔ site.webmanifest
       [Builder] Building @fab/plugin-render-html:
[@fab/plugin-r…] Compiled 88 html files.
[…n-render-html] No fallback injected.
       [Builder] Building @fab/plugin-rewire-assets:
[@fab/plugin-r…] Inlining 117 assets.
[…rewire-assets] ✔ Done.
[…rewire-assets] Generating server code to rewire 135 assets.
[…rewire-assets] ✔ Done.
       [Builder] Build plugins completed in 3.21 seconds.
     [Typecheck] No Typescript plugins detected. Skipping.
      [Compiler] Compiling your server.js:
      [Compiler] Done in 8.61 seconds.
... snip ...
/server.js (12.9 MB)
     [Generator] Done in 0.17 seconds.
     [Generator] Zipping it up into a FAB:
     [Generator] Created fab.zip (9.38 MB) in 1.07 seconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions