[ERROR] No loader is configured for ".html" files: index.html
Hi. I feel like I've done really well getting as far as I have, but I'm still missing a detail or three. The error I receive is in the title.
I have a Git repo I'm deploying from that contains these files (a basic static html site)::
index.html
style.css
README.md
My Build config looks like this::
Build command: exit 0
Deploy command: npx wrangler deploy ./index.html
Version command: npx wrangler versions upload
Root directory: ./
I've been mucking with the paths for "Deploy command" and "Root dir" but would rather know that I'm doing things properly than guessing at what might work.
It looks like I need some combination of a wrangler.toml file and index.js, but I'm not sure where they go (in the top folder with html & css?) or what the contents should actually be. I don't know if an assets directory is needed or if I need to use template files. Right now I'm posting a single page site but want to learn to do it for a multi-page site (couple dozen pages) too and it would be disappointing if I have to edit all pages into templates.
Tips appreciated!!
8 Replies
Ok, I figured out wrangler.toml goes in the root dir, and so far I have::
name = "example-net"
main = ""
compatibility_date = "2025-06-09"
The name should be the worker name, not the site name, correct?
The deploy command should be given a directory, not an HTML file. And you're gonna need that wrangler.toml (or json) file. It will probably help to start with a template. You can use
npm create to set up a new project. See here: https://developers.cloudflare.com/workers/static-assets/get-started/Cloudflare Docs
Get Started
Run front-end websites — static or dynamic — directly on Cloudflare's global network.
Alright, starting the folder the way that describes did get me a lot further, and I've copied my static files into that structure (in the public folder). The things I'm stuck on now are (1) When I 'npx wrangler dev' and visit the URL, the site is there (progress!) but when I exit that I get two errors about not resolving strip-cf-connecting-ip-header.js or middleware-loader.entry.ts --- is that something I should be concerned about? What to do? (2) This might be related, I have 10 Changes in Git that I cannot stage --- all in the node_modules folder. What to do?
For (2) --
node_modules should be in your .gitignore. (I'm surprised the template didn't do that for you.)
For (1) that sounds like you have reference to those filenames in your code, because that's not normal otherwise.Thanks!! For (1) it didn't happen the second time I ran dev, so maybe it's off my list.
For (2) I saw mention of .gitignore when searching the web, but also saw someone with the opinion that they shouldn't be git-ignored. I gather it's fairly ok to do so.
Everyone git-ignores their
node_modules. I mean, I'm sure there exist people who don't, but it's not common and makes no sense to commit node_modules to git.ok, thank you a bunch!! 👍
You're welcome 🙂