Skip to content

Releases: cloudflare/next-on-pages

[email protected]

29 Jun 10:31
8346e05
Compare
Choose a tag to compare

Patch Changes

  • daa32fd: update no-unsupported-config rules (to match the latest supported configs table)

  • c21c995: add fallback detection check in no-unsupported-configs rule

    add an additional check in the no-unsupported-configs rule so that if the rule
    were to fail detecting the config's name as a last resort we fall back checking
    the variable declaration present just after the "/*_ @type {import('next').NextConfig} _/"
    comment

@cloudflare/[email protected]

29 Jun 10:31
8346e05
Compare
Choose a tag to compare

Minor Changes

  • 2f9cf97: Support for using a custom output directory for the generated worker and static assets, through a --outdir flag.

Patch Changes

  • f879ffd: Prevent middleware redirects applying search params.

    When a middleware function results in a redirect, the location header specified in the response is the full destination, including any search params, as written by the developer. Previously, we always applied search params to redirects found during the routing process, no matter what. This meant that we accidentally were applying search params to middleware redirects, which would alter the intended final destination. This change prevents that from happening.

  • 3a95489: Fix middleware returning new NextResponse resulting in 404 for routes that don't exist in the build output.

  • 2dceb75: Fix middleware being invoked multiple times in a phase during routing when there is more than one config entry.

[email protected]

26 Jun 10:48
b021650
Compare
Choose a tag to compare

[email protected]

26 Jun 09:49
2f63de8
Compare
Choose a tag to compare

@cloudflare/[email protected]

26 Jun 10:48
b021650
Compare
Choose a tag to compare

Minor Changes

  • 2c87481: Display a summary about the build at the end of the build process.

Patch Changes

  • b1c3a33: fix --info showing [object Promise] for relevant packages instead of their versions

  • a9b8c3c: Overwrite prerendered files if they already exist in the output directory.

    When using --skip-build, it would fail if a prerendered file already existed, so we need to override the files so that the build process can continue like normal. This was problematic as after the first build, the prerendered files would now exist in the output directory as static assets, preventing any additional builds.

  • b1c3a33: fix vercel command not found issue

@cloudflare/[email protected]

26 Jun 09:49
2f63de8
Compare
Choose a tag to compare

Patch Changes

  • b1c3a33: fix --info showing [object Promise] for relevant packages instead of their versions

  • a9b8c3c: Overwrite prerendered files if they already exist in the output directory.

    When using --skip-build, it would fail if a prerendered file already existed, so we need to override the files so that the build process can continue like normal. This was problematic as after the first build, the prerendered files would now exist in the output directory as static assets, preventing any additional builds.

  • b1c3a33: fix vercel command not found issue

v1.1.0

15 Jun 13:44
1f930d3
Compare
Choose a tag to compare

Minor Changes

  • 1be5e72: Support for the wildcard option in the Vercel build output config.

Patch Changes

  • 783dc79: Added package.json to list of ignored files in watch mode to ensure compatibility with yarn (classic)
  • fb818bf: Fix i18n locale index routes not matching for SSR'd index pages.
  • 016b8d3: Fix set-cookie headers overriding when more than one is set, instead of appending.
  • d835933: Prevent the route group stripping regex from removing intercept routes.

v1.0.2

06 Jun 20:34
6455355
Compare
Choose a tag to compare

Patch Changes

  • f687d25: update the runtime error message so that it provides accurate up-to-date information
  • ff90dde: Remove rsc functions from the worker output directory as we replace them with non-rsc variants in the config given to the router. This reduces the final bundle size.
  • cb62938: Fix dynamic params not being derived correctly in some cases when running a page's function.
  • d91b24b: Fix middleware not returning a response with new NextResponse and when there is no x-middleware-next header present.
  • 7deb9d8: Fix non-index pages with trailing slash rewriting to /index for rsc requests.

v1.0.1

25 May 17:46
c844242
Compare
Choose a tag to compare

Patch Changes

  • 29b7547: improve no nodejs_compat flag runtime error message

  • c0ecec3: introduce wasm support

    introduce wasm support by tweaking how the wasm modules are imported, what vercel build does is adding dynamic
    requires at the top of the func files, like for example:

    // file: .vercel/output/functions/index.func/index.js
    const wasm_fbeb8adedbc833032bda6f13925ba235b8d09114 = require('/wasm/wasm_fbeb8adedbc833032bda6f13925ba235b8d09114.wasm');

    then such identifier is used in the rest of the file (likely only inside chunks), as in:

        // file: .vercel/output/functions/index.func/index.js
        649:e=>{e.exports=wasm_fbeb8adedbc833032bda6f13925ba235b8d09114}

    the above can't work with next-on-pages because:

    • dynamic requires are not supported
    • when we perform the chunks deduplication chunks containing such identifiers will not find their declaration causing
      (e.g. a chunk file containing the 649 chunk code illustrated above won't know where wasm_fbeb8adedbc833032bda6f13925ba235b8d09114
      comes from and would just provide a runtime error saying that it is not defined)
    • /wasm/... isn't a real directory, just some sort of convention used by vercel, the wasm files are located in the same
      directory as the func file

    the adopted solution consists in:

    • copying the wasm files from their func relative locations into the __next-on-pages-dist/wasm directory
    • converting the func top level requires into standard relative esm imports, like for example:
      // file: .vercel/output/functions/index.func/index.js
      import wasm_fbeb8adedbc833032bda6f13925ba235b8d09114 from '../wasm/wasm_fbeb8adedbc833032bda6f13925ba235b8d09114.wasm';
      so that any part of the func file will be able to reference the variable (so that this works with chunks deduplication disabled)
    • adding similar import statements to any chunk files that reference these wasm identifiers, like for example:
      // file: .vercel/output/static/_worker.js/__next-on-pages-dist__/chunks/649.js
      import wasm_fbeb8adedbc833032bda6f13925ba235b8d09114 from '../wasm/wasm_fbeb8adedbc833032bda6f13925ba235b8d09114.wasm';
      var a = b => {
      	b.exports = wasm_fbeb8adedbc833032bda6f13925ba235b8d09114;
      };
      export { a as default };
      (so that this works with chunks deduplication enabled)
  • 3f05e81: update wrangler peer dependency (^2.20.0 -> ^3.0.0)

  • 4f43b9b: Fix the issue of refetching the vercel package every single time when using yarn berry.

  • 81bfcdb: allow any node built-in module to be statically imported correctly

    currently only static imports from "node:buffer" work correctly, other
    imports, although supported by the workers runtime, aren't handled correctly
    (such as "node:events" and "node:util"), fix this by making sure we handle
    imports from any of the node built-in modules

    Note
    some node built-in modules supported by the workers runtime still cannot be
    correctly imported (like "node:path" for example), but this is because they
    seem to be not allowed by vercel/next itself (so it's something unrelated to
    next-on-pages)

  • 95b1704: Fix non-dynamic trailing slash pages not matching when using trailingSlash: true.

  • fd51777: remove hacks/workarounds for runtime bugs which are no longer needed

  • 97c8739: fix getPackageVersion and use it to discern use of dlx

    fix the getPackageVersion function so that it doesn't wrongly produce N/A (thus
    improving the -i|--info results)

    the when running vercel build, use the function to discern if dlx should be added
    (for yarn (berry) and pnpm commands), ensuring that the vercel package is not
    unnecessarily re-fetched/installed

    Note
    Currently the aforementioned check (and build command) runs next-on-pages-vercel-cli
    anyways that's a temporary solution, the changes here will also apply when we switch
    back to the proper vercel cli package

v1.0.0

16 May 12:00
f010420
Compare
Choose a tag to compare

Major Changes

  • 3e2dad8: use and rely on AsyncLocalStorage

    previously we've been using the node AsyncLocalStorage in a non-breaking way but now we are committing
    to in and using it to store the global env variables as well

    this is a breaking change since moving forward all app running using @cloudflare/next-on-pages must
    have the nodejs_compat compatibility flag set (before not all needed that)

Minor Changes

  • 6fcb58b: make the experimental minification the default behavior and add an option to disabled it

    as part of this:

    • make --experimental-minify|-e a no-op argument which simply shows a warning which indicates that it is
      a deprecated option (we aren't removing the flag so that we don't break existing build scripts)
    • add a --disable-worker-minification|-m option to disable the minification of the _worker.js script (which
      currently coincides with the experimental minification)
  • e053756: add nodejs_compat runtime check

    add a runtime check for the presence of the nodejs_compat flag at runtime so that if developers
    forget to use such flag instead of receiving an internal server error they receive an error specifically
    telling them that they have not specified the flag

  • 87e183b: New routing system runtime handling and implementation.

    Improves support for advanced routing with Next.js applications on Pages, through leveraging the Vercel build output configuration. The Vercel build output specifies the relevant routing steps that are taken during the lifetime of a request, and this change implements a new system that handles these steps.

  • ea761b8: remove disable-chunks-dedup flag

  • 86df485: Support for the internationalization (i18n) option in next.config.js, and locale redirects.

  • 4d8a708: utilize Wrangler new capability of dynamically importing code to avoid the evaluation/run of javascript code
    when not necessary, reducing the app's startup time (which causes apps to often hit the script startup CPU time limit)

Patch Changes