Skip to content

Commit 94016ca

Browse files
Formatting and editing, clarifications etc
1 parent c1dd976 commit 94016ca

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

README.MD

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Webpack Boilerplate for Cloudflare Workers
22

3-
A superbly simple minimal-config template for building, bundling and deploying Cloudflare Workers with Webpack 🚀
3+
A superbly simple, minimal-config template for building, bundling and deploying Cloudflare Workers with Webpack 🚀
44

55
![Running npm run deploy in a terminal](.github/cf-worker-webpack-boilerplate-deploy.gif?raw=true "npm run deploy")
66

7-
Webpack can seem like voodoo to the unfamiliar, so the goal here is to provide a reusable boilerplate with sane default configuration that allows anyone to bundle up a worker script with any NPM dependencies, and upload directly to Cloudflare.
7+
 
8+
9+
------
10+
11+
 
12+
13+
Webpack can seem like voodoo to those unfamiliar with its infamous config 💀
14+
15+
So the goal here is to provide an easy-to-use template — with sane default settings — that'll bundle up your worker script with its `require()`'ed npm modules, upload it to Cloudflare, and even activate its route(s).
816

917
### What you configure:
1018
- Your Cloudflare credentials
@@ -15,13 +23,13 @@ Webpack can seem like voodoo to the unfamiliar, so the goal here is to provide a
1523
- Transparent, optimized and ready-to-rock Webpack configuration file
1624
- Babel configuration ensuring development-setup build compatibility for Node 6 and up
1725
- Babel-assured compatibility for Worker's JavaScript in the latest CF-Worker (i.e. Chrome) runtime
18-
- Dynamic polyfilling, applied only when needed (which is anyways very unlikely!)
26+
- On-demand polyfilling in the (very unlikely) event that it's needed
1927
- Baked-in **management of route matching patterns**, if and when routes are provided
2028
- Minification of deployed Worker scripts to help keep them under the 1MB limit
21-
- A ready-to-deploy example Worker in worker.js using `require()`, with comments to help make sense of it all
29+
- A deployable example Worker featuring `require()`, and with comments to help make sense of it all
2230

2331
### Requirements:
24-
- Min. Node version 6
32+
- Minimum Node.js version 6
2533

2634
## Quick Start
2735

@@ -31,12 +39,12 @@ Webpack can seem like voodoo to the unfamiliar, so the goal here is to provide a
3139

3240
cd cloudflare-worker-webpack-boilerplate
3341
````
34-
2. Rename `example.env` to `.env` , and add your required Cloudflare credentials, and either your site name or zone-id.
42+
2. Rename `example.env` to `.env` , and add your required Cloudflare credentials, and either your site name or site's zone-id.
3543
3. Install dependencies with `npm install`
3644
4. Write your worker script in `src/worker.js`
37-
- Add any dependencies for your worker with: `npm install -P <some-required-package>`
38-
- Build a preview of your bundled worker script (found in `dist/bundled-worker.js`) by running: `npm run build`
39-
5. Build, bundle and launch your Worker to the Cloudflare edge 🚀 using: `npm run deploy`
45+
- Install any dependencies for your worker with: `npm install -P <some-npm-module>`
46+
- Build a preview of your bundled worker script in `dist/bundled-worker.js` by running: `npm run build`
47+
5. Build, bundle and launch your ~~minion~~ Worker to the Cloudflare Edge 🚀 using: `npm run deploy`
4048
4149
4250
### Example Cloudflare Worker
@@ -54,8 +62,9 @@ It then adds a response header in the form of:
5462
5563
#### Using the Example Worker
5664
57-
After completing steps 1-3 above, you can build the example script with `npm run build:example`,
58-
or even deploy it to production with `npm run deploy:example`
65+
After completing steps 1-3 above, you can build the example script with `npm run build:example`
66+
67+
You can even deploy it live to your site with `npm run deploy:example`
5968
6069
6170
## Configuration
@@ -78,7 +87,7 @@ You **must** provide a means of identifying your Cloudflare site deployment targ
7887
7988
or
8089
81-
- `CLOUDFLARE_SITE_NAME`: The fully qualified domain name (FQDN) of your site
90+
- `CLOUDFLARE_SITE_NAME`: The fully qualified domain name (FQDN) of your site, e.g. _example.lol_
8291
8392
### Additional Config
8493

0 commit comments

Comments
 (0)