github cloudflare/workers-sdk wrangler@3.46.0

Minor Changes

  • #5282 b7ddde1 Thanks @maxwellpeterson! - feature: Add source map support for Workers

    Adds the source_maps boolean config option. When enabled, source maps included in the build output are uploaded alongside the built code modules. Uploaded source maps can then be used to remap stack traces emitted by the Workers runtime.

  • #5215 cd03d1d Thanks @GregBrimble! - feature: support named entrypoints in service bindings

    This change allows service bindings to bind to a named export of another Worker. As an example, consider the following Worker named bound:

    import { WorkerEntrypoint } from "cloudflare:workers";
    
    export class EntrypointA extends WorkerEntrypoint {
    	fetch(request) {
    		return new Response("Hello from entrypoint A!");
    	}
    }
    
    export const entrypointB: ExportedHandler = {
    	fetch(request, env, ctx) {
    		return new Response("Hello from entrypoint B!");
    	}
    };
    
    export default <ExportedHandler>{
    	fetch(request, env, ctx) {
    		return new Response("Hello from the default entrypoint!");
    	}
    };

    Up until now, you could only bind to the default entrypoint. With this change, you can bind to EntrypointA or entrypointB too using the new entrypoint option:

    [[services]]
    binding = "SERVICE"
    service = "bound"
    entrypoint = "EntrypointA"

    To bind to named entrypoints with wrangler pages dev, use the # character:

    $ wrangler pages dev --service=SERVICE=bound#EntrypointA

Patch Changes

  • #5215 cd03d1d Thanks @GregBrimble! - fix: ensure request url and cf properties preserved across service bindings

    Previously, Wrangler could rewrite url and cf properties when sending requests via service bindings or Durable Object stubs. To match production behaviour, this change ensures these properties are preserved.

  • Updated dependencies [cd03d1d, 6c3be5b, cd03d1d, cd03d1d]:

    • miniflare@3.20240403.0

Don't miss a new workers-sdk release

NewReleases is sending notifications on new releases.