List of Files Ignored by Wrangler Pages CLI
At the time of this writing, the Pages command of Cloudflare’s Wrangler CLI uses a hard-coded list of ignored files and directories. The list isn’t written anywhere in the Wrangler documentation, so far as I can tell, but it can be found in the source files.
Here’s how the ignore list is declared as of commit a3e654f:
// packages/wrangler/src/pages/upload.tsx
const IGNORE_LIST = [
"_worker.js",
"_redirects",
"_headers",
"_routes.json",
".DS_Store",
"node_modules",
".git",
];
(Note: The _redirects
and _headers
files don’t get uploaded, but Wrangler reads them when configuring custom redirects and response headers as outlined in the Cloudflare Pages documentation.)
If you’re using a static site generator like Jekyll or Hugo, and you want it to generate files to be served on your localhost
but not on Cloudflare Pages, just add /node_modules/
to the URI path.
In Jekyll, you can achieve this easily by setting the permalink
frontmatter variable in the document you want to keep local.
---
permalink: '/node_modules/secret-sitemap'
---
Wrangler will ignore the _site/node_modules
directory and everything in it when you run:
$ npx wrangler pages publish _site
Keep in mind that Wrangler’s Pages command is still in beta.
The full release will no doubt have support for defining a custom list of excludes through wrangler.toml
and command line flags.
Last updated on . Written by Joshua F. Gonzales.
Permalink: https://writing.joshua.law/files-ignored-by-wrangler-pages-cli