How to upload static file into Cloudflare worker?

How to upload static files into Cloudflare worker?

This is my file structure-

my-project/
├── src/
│ └── worker.js # Your Worker script
├── public/ # Folder containing your static files
│ ├── index.html
│ ├── script.js
│ ├── widget.js
│ └── style.css
└── wrangler.toml

public folder have all the static file.

this is my wrangler.toml file.

name = "project_name"
main = "src/worker.js"
compatibility_date = "2023-11-09"
env = { }

[triggers]
crons = [ ]

[site]
bucket = "./public"  # Path to your static files

So whenever I use command “wrangler deploy”, it does not push the public folder to the cloudflare worker but I get success message-

What’s I am doing wrong?

In that message you showed it doesn’t upload the files because they are already uploaded.

How are you validating they exist and how are you accessing them in the Worker?

I would also recommend considering Cloudflare Pages with Functions.