Tutorials

Wrangler 4.169.1 Fixes Incomplete Cloudflare Project Setup

Cloudflare's November 29 update improves automatic project setup when generating cloudflare.config.ts. See how to configure an existing TypeScript project without overwriting its scripts or build settings.

You run Cloudflare’s automatic configuration on an existing project. The command detects your framework, creates cloudflare.config.ts, and reports that setup is complete.

Then you try to build the application.

A dependency is missing. Perhaps TypeScript cannot find its configuration, or the project has no command for starting the Cloudflare development environment.

The Cloudflare configuration exists, but the project isn’t necessarily ready to use it.

On November 29, 2026, Cloudflare released Wrangler 4.169.1, including changes to the shared automatic-configuration tooling in PR #17164.

The update addresses several gaps in project setup: missing manifests, TypeScript configuration, build tools, package scripts, and static asset exclusions.

There is also an important distinction between the two Cloudflare command-line tools involved here.

Wrangler handles traditional Worker configurations such as wrangler.jsonc. The newer Cloudflare CLI, cf, uses cloudflare.config.ts and can delegate builds to Vite, the Cloudflare Vite plugin, or Wrangler.

The new setup improvements concern the infrastructure connecting these tools. They do not mean that every project should migrate from Wrangler to cf.

Why creating cloudflare.config.ts was not enough

A Cloudflare project can need several files before it can build successfully.

For a TypeScript application, these may include:

my-app/
├── src/
│   └── main.ts
├── package.json
├── tsconfig.json
├── vite.config.ts
└── cloudflare.config.ts

The files have different responsibilities.

cloudflare.config.ts describes the Cloudflare deployment, including its Worker configuration.

package.json declares the installed tooling and project scripts.

tsconfig.json controls how TypeScript analyzes the project.

And vite.config.ts configures the Vite build pipeline, potentially including the Cloudflare Vite plugin.

Creating only the Cloudflare configuration does not guarantee the other pieces exist.

The update changes how automatic configuration handles those dependencies.

When setup generates cloudflare.config.ts, it can now create a missing package.json or tsconfig.json, install the tools required by the selected build path, and add project scripts that do not already exist.

Existing scripts and compiler settings are preserved.

1. Prepare an existing TypeScript project

For this example, assume you have a small Vite application that has not yet been configured for Cloudflare.

It should not already contain wrangler.jsonc, wrangler.toml, or another Wrangler configuration.

Open the project directory and install the Cloudflare tooling:

pnpm add -D cf@latest [email protected]

Here, cf provides commands such as cf init and cf build.

Wrangler 4.169.1 is the version containing the announced patch. Installing it explicitly is useful when examining the new Wrangler release, but a Vite project may use the Cloudflare Vite plugin instead.

For cf-managed projects, the version of cf and its automatic-configuration dependencies also matters.

Check the installed tools:

pnpm exec cf --version
pnpm exec wrangler --version

The commands identify the executables available in the project.

Now run:

pnpm exec cf init .

The final dot means that the current directory should be configured.

Cloudflare inspects the project and determines which framework and build tools it can use.

For a supported Vite application, setup may install the Cloudflare Vite plugin, modify vite.config.ts, and create cloudflare.config.ts.

Review the proposed changes before confirming them.

The resulting files depend on the existing project. The CLI does not need to recreate configurations that are already usable.

2. What happens when package.json is missing?

The fix also covers simpler projects that may not have a Node.js manifest at all.

Consider a small static site:

my-site/
└── index.html

When automatic configuration chooses a build path that generates cloudflare.config.ts, the updated tooling can create the supporting project files.

A newly generated package.json includes:

{
  "type": "module"
}

The complete file also contains project-specific metadata, dependencies, and scripts.

The "type": "module" field matters because the generated Cloudflare configuration uses ECMAScript modules.

Without an appropriate module configuration, Node.js may warn about how the file is being loaded.

The new setup process handles this when creating a manifest.

However, it does not blindly rewrite an existing manifest’s module type.

That distinction protects projects whose existing scripts or dependencies rely on CommonJS behavior.

3. Existing scripts are preserved

Suppose your application already has:

{
  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "test": "vitest run"
  }
}

Replacing those commands with cf dev and cf build could remove important project-specific behavior.

For example, the original build script runs TypeScript’s project build before invoking Vite.

The updated automatic configuration preserves existing scripts and adds missing ones.

When a project has no corresponding scripts, it can add defaults such as:

{
  "scripts": {
    "dev": "cf dev",
    "build": "cf build",
    "deploy": "cf deploy"
  }
}

This is an illustrative result for a project missing all three commands, not the guaranteed output for every framework.

There is a subtle detail here.

When a Vite project uses cf build, the CLI delegates to the selected build tool. It does not simply execute the build script from package.json.

So if your original script includes additional steps, preserve them explicitly:

{
  "scripts": {
    "build": "tsc -b && cf build"
  }
}

Use this arrangement when the Cloudflare build path is the intended replacement for your previous Vite build.

The release aims to preserve the project’s existing workflow rather than silently overwrite it.

4. Verify the generated configuration

After setup, inspect the project files before attempting deployment.

First, check that cloudflare.config.ts was created and that its settings match the intended Worker.

Then inspect vite.config.ts to confirm that the Cloudflare Vite plugin has been configured when the project uses that build path.

Check package.json for the required dependencies and scripts.

If a TypeScript configuration was missing, verify that tsconfig.json now exists.

The patch includes a default TypeScript configuration with settings such as:

{
  "compilerOptions": {
    "module": "preserve",
    "moduleResolution": "bundler",
    "strict": true,
    "noEmit": true
  }
}

This is a shortened excerpt of the generated configuration.

An existing TypeScript configuration should not be replaced merely because automatic setup runs.

Once the configuration looks correct, start local development:

pnpm exec cf dev

Then try a production build:

pnpm exec cf build

A successful build writes Cloudflare Build Output under:

.cloudflare/output/v1/

The build command does not deploy the application.

That separation is useful when checking a newly configured project: you can verify the generated output before publishing anything.

5. Why .assetsignore matters

The release includes another change that is particularly relevant to static sites.

Some projects serve files directly from their root directory.

That creates an awkward situation when the root also contains development tooling.

Without suitable exclusions, files such as configuration files, package manifests, or node_modules could become part of the directory being processed as public assets.

The updated automatic configuration adds appropriate rules to .assetsignore when the project root is used as the static assets directory.

For example:

node_modules
/.cloudflare
/cloudflare.config.ts
/package.json
/tsconfig.json

This is an illustrative subset of possible generated rules.

The update also makes Wrangler’s asset watcher and build-output copying respect .assetsignore consistently.

That means ignored files can be excluded from static asset handling during development and builds.

Cloudflare also corrected handling around ignored directories and broken symbolic links.

These changes matter because a project that serves its root should not accidentally expose development files simply because they happen to exist beside index.html.

Still, .assetsignore should be inspected rather than treated as a complete security policy.

Keep credentials and other sensitive files outside public asset directories, and verify the resulting build output.

6. Why explicit CommonJS projects are different

Suppose an existing project declares:

{
  "type": "commonjs"
}

It may depend on CommonJS module loading.

Changing that value to "module" could break existing JavaScript files using require() or module.exports.

The updated setup process does not silently make that change.

When the explicit CommonJS setting prevents the generation of a usable cloudflare.config.ts, automatic configuration reports an error instead.

This is intentional.

A configuration tool should not solve one compatibility problem by unexpectedly changing the module behavior of the entire application.

If the project needs to move toward ESM, that should be a deliberate migration.

The new release also improves how Vite configurations are handled in projects that retain CommonJS-oriented settings, including cases where an ESM-compatible configuration file can be created without changing the package’s module type.

7. Do not run cf init over an existing Wrangler project

There is one restriction that deserves particular attention.

If your project already contains:

wrangler.jsonc

or:

wrangler.toml

do not simply run cf init . to add the newer configuration format.

Cloudflare documents that automatic setup does not read existing Wrangler configuration files.

It may therefore generate a Cloudflare configuration that does not preserve the existing Worker’s entry point, bindings, or other deployment settings.

For projects already managed through Wrangler, use the documented migration workflow:

cf migrate

This is a separate process from configuring an existing Vite project that has never used Wrangler.

The distinction also applies to CI.

Cloudflare’s automatic setup can run without prompting in non-interactive environments, including CI jobs.

That makes automation convenient, but it also means configuration changes may be applied without a developer confirming them interactively.

For an existing project, run setup locally, inspect the generated files, and commit the intended configuration before enabling automated builds.

What changed on November 29?

The new release does not introduce cf init, TypeScript configuration, or the Cloudflare Vite plugin for the first time.

Those features already existed.

Wrangler 4.169.1 incorporates improvements to the automatic setup process that previously could leave projects only partially configured.

The changes cover missing project files, required tooling, preservation of existing scripts, TypeScript settings, module compatibility, and static asset exclusions.

The benefit is most noticeable in projects that do not already follow a complete Cloudflare project template.

A minimal static site may have no package.json. A Vite application may lack a Cloudflare configuration. A monorepo may keep its build tools at the workspace root.

The setup process now accounts for more of those arrangements instead of assuming that every required file and executable is already present.

But the final check remains the same: a generated configuration file is only one part of a usable deployment.

The project should still be able to start locally, produce a valid build, and preserve the behavior of its existing scripts.

External Sources used for this article

Related Articles

View all →