wrangler
4.164.0 · 17 Nov 2026MIT OR Apache-2.049.3M / weekRepositoryHomepagenpmAtom feed
4.167.0 is the newest release of 4.x.
In short
4 new9 fixed3 internal
Release note
Minor Changes
Add
WRANGLER_CACHE_DIRenvironment variable and smart cache directory detectionWrangler now intelligently detects where to store cache files:
Use
WRANGLER_CACHE_DIRenv var if setUse existing cache directory if found (
node_modules/.cache/wrangleror.wrangler/cache)Create cache in
node_modules/.cache/wranglerifnode_modulesexistsOtherwise use
.wrangler/cache
This improves compatibility with Yarn PnP, pnpm, and other package managers that don't use traditional
node_modulesdirectories, without requiring any configuration.Ensure the
nodejs_compatflag is always applied in autoconfigPreviously, the autoconfig feature relied on individual framework configurations to specify Node.js compatibility flags, some could set
nodejs_compatwhile othersnodejs_als.Now instead
nodejs_compatis always included as a compatibility flag, this is generally beneficial and the user can always remove the flag afterwards if they want to.Support
--tagand--messageflags onwrangler deployThey have the same behavior that they do as during
wrangler versions upload, as both
are set on the version.The message is also reused for the deployment as well, with the same behavior as used
duringwrangler versions deploy.
Patch Changes
Fix AI Search binding failing in local dev
Using AI Search bindings with
wrangler devwould fail with "RPC stub points at a non-serializable type". AI Search bindings now work correctly in local development.Exclude
.wranglerdirectory from Pages uploadsThe
.wranglerdirectory contains local cache and state files that should never be deployed. This aligns Pages upload behavior with Workers Assets, which already excludes.wranglervia.assetsignore.Fix port availability check probing the wrong host when host changes
memoizeGetPortcorrectly invalidated its cached port when called with a different host, but then still probed the original host for port availability. This could return a port that was free on the original host but already in use on the requested one, leading to bind failures at startup.Support function-based Vite configs in autoconfig setup
wrangler setupandwrangler deploy --x-autoconfigcan now automatically add the Cloudflare Vite plugin to projects that use function-baseddefineConfig()patterns. Previously, autoconfig would fail with "Cannot modify Vite config: expected an object literal but found ArrowFunctionExpression" for configs like:export default defineConfig(({ isSsrBuild }) => ({ plugins: [reactRouter(), tsconfigPaths()], }));This pattern is used by several official framework templates, including React Router's
node-postgresandnode-custom-servertemplates. The followingdefineConfig()patterns are now supported:defineConfig({ ... })(object literal, already worked)defineConfig(() => ({ ... }))(arrow function with expression body)defineConfig(({ isSsrBuild }) => ({ ... }))(arrow function with destructured params)defineConfig(() => { return { ... }; })(arrow function with block body)defineConfig(function() { return { ... }; })(function expression)
Fix
.assetsignoreformatting when autoconfig creates a new filePreviously, when
wrangler setuporwrangler deploy --x-autoconfigcreated a new.assetsignorefile via autoconfig, it would add unnecessary leading empty lines before the wrangler-specific entries. Empty separator lines should only be added when appending to an existing.assetsignorefile. This fix ensures newly created.assetsignorefiles start cleanly without leading blank lines.Improve error message when port binding is blocked by a sandbox or security policy
When running
wrangler devinside a restricted environment (such as an AI coding agent sandbox or locked-down container), the port availability check would fail with a rawEPERMerror. This now provides a clear message explaining that a sandbox or security policy is blocking network access, rather than the generic permission error that previously pointed at the file system.Improve framework detection when multiple frameworks are found
When autoconfig detects multiple frameworks in a project, Wrangler now applies smarter logic to select the most appropriate one. Selecting the wrong one is acceptable locally where the user can change the detected framework, in CI an error is instead thrown.
Add trailing newline to generated
package.jsonandwrangler.jsoncfilesFix
.gitignoreformatting when autoconfig creates a new filePreviously, when
wrangler setuporwrangler deploycreated a new.gitignorefile via autoconfig, it would add unnecessary leading empty lines before the wrangler-specific entries. Empty separator lines should only be added when appending to an existing.gitignorefile. This fix ensures newly created.gitignorefiles start cleanly without leading blank lines.Throw actionable error when autoconfig is run in the root of a workspace
When running Wrangler commands that trigger auto-configuration (like
wrangler devorwrangler deploy) in the root directory of a monorepo workspace, a helpful error is now shown directing users to run the command in a specific project's directory instead.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.