Cloudflare Workers® aims to be the easiest and most powerful platform for developers to build and deploy their applications. With Workers, you can quickly solve problems without having to wonder: 'is this going to scale?'

You write the JavaScript and we handle the rest, from distribution to scaling and concurrency.

In the spirit of quickly solving problems, we're excited to launch three new improvements to the Workers experience, so you can take your next idea and ship it even faster.

Introducing... workers.new

First, we're introducing https://workers.new, a shortcut that takes you directly to a JavaScript editor for creating a new Worker. Anytime you have a cool idea, need a quick fix to a problem, or just want to debug some JavaScript, you now have a simple way to go from idea to prototype. What's more is you don't even need to deploy the Worker to try it out!

We've also updated the default Worker template to help you go a few steps beyond the typical 'Hello, World!'. When you open the editor, you'll now see a few examples that demonstrate how to redirect requests, modify headers, and parse responses.

Customize your build scripts

For developers who want to deploy more complex applications, like those with external libraries or written in other languages like TypeScript, we recommend using our command-line tool, wrangler.

Previously, wrangler has supported three project types: JavaScript, Rust, and webpack. By far, we've found that webpack is the most widely used among the community, since it has built-in support for bundling npm packages. Yet, as more developers started to use wrangler, they've wanted to customize their webpack configurations or even use other JavaScript bundlers.

That's why we're excited to release custom builds for wrangler! Now you can provide wrangler with a custom build script and upload directory, which works with all of the wrangler commands including wrangler dev and wrangler publish.

This means you can use any JavaScript bundler you want: webpack, Rollup, Parcel, esbuild, and many more! We've put together a few templates that you can copy if you want to get started with custom builds. Make sure to update wrangler to release 1.16 or later and check out our documentation about custom builds and additional configuration options.

  • webpack
  • webpack with Durable Objects
  • Rollup
  • Rollup with Durable Objects
Viewing logs and exceptions

Ever wanted to see the console.log() output or uncaught exceptions from a deployed Worker?

In case you missed it, wrangler tail allows you to see a live stream of your Worker's logs and exceptions. Today, we're improving wrangler tail by making it easier to use and more accessible to developers.

First, we wanted to improve the terminal output. Previously, wrangler tail would only output log entries as JSON. While this was useful when piping through to tools like jq, it was generally hard to digest. That's why we created a new 'pretty' format that is much easier to read and takes full advantage of your terminal's color codes.


$ wrangler tail --format=<_json7c_pretty>

If you have suggestions for how we can improve wrangler tail, feel free to pop in the #wrangler channel on the Workers Discord. We're excited to see what you ship with these improvements!

A sneak preview

As we like to say at Cloudflare, we're just getting started. While we have plans to add improvements to wrangler... where else could we introduce logs?

Stay tuned.

Attachments

  • Original document
  • Permalink

Disclaimer

CloudFlare Inc. published this content on 16 April 2021 and is solely responsible for the information contained therein. Distributed by Public, unedited and unaltered, on 16 April 2021 13:29:09 UTC.