wrangler generate proj --site: Creates a project with a Worker serving a generic HTML file and favicon with the directory structure:
├── public # files to serve | ├── favicon.ico | └── index.html ├── workers-site | ├── index.js # Workers script that serves the assets | ├── package-lock.json | └── package.json # defines dependencies used by Workers script └── wrangler.toml
entry-point (defaults to
bucket (defaults to
wrangler init proj --site: Creates a
workers-sitefolder. You’ll need to add a value for
bucketbased on the local path of folder you’d like to be serve.
There are a few specific configuration settings for Workers Sites in your
||The directory containing your static assets, path relative to your
||The location of your Worker script, default is
Note: if your project uses environments, make sure to place
site at the top level config.
Example of a
account_id = "95e..." name = "docs-site-blah" type = "webpack" workers_dev = false [site] bucket = "./public" entry-point = "workers-site" [env.production] name = "docs-site" route = "https://ex.com/docs*" zone_id = "351c.." account_id = "b54f07a.." [env.staging] zone_id = "ef47a..." account_id = "95e5d..." name = "docs-site-staging" route = "https://staging.ex.com/docs*"
For very exceptionally large pages, Workers Sites might not work for you. There is a 2MB limit per page.