I use pnpm for the install when you use npm or yarn you have to change it.
For more depth how to use Cloudflare Worker in Typescript go to the following repo worker-typescript-template
Here some repos where this template is used
Use the command
wrangler generate my-ts-project https://github.com/HaxSam/cloudflare-worker-template/
Change the following files with your information
- wrangler.toml
name = "cloudflare-worker-template"
...
command = "pnpm install && pnpm build"
- package.json
{
"name": "cloudflare-worker-template",
"version": "1.0.0",
"description": "A template for creating a Cloudflare Worker with Typescript and a simple Routing class",
"author": "HaxSam",
}
Copyright for portions of project cloudflare-worker-template are held by [Github Account HaxSam Owner, 2022] as part of project worker-typescript-template
All other copyright for project cloudflare-worker-template are held by [Github Account HaxSam Owner, 2022].
Check the LICENSE for more details.