Skip to content

Redundant warning when deploying Vite-built Worker(s) #10920

@scruffymongrel

Description

@scruffymongrel

What versions & operating system are you using?

System:
OS: macOS 15.6.1
CPU: (8) arm64 Apple M2
Memory: 75.33 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.11.0 - /opt/homebrew/bin/node
npm: 10.9.2 - /opt/homebrew/bin/npm
pnpm: 10.11.0 - /opt/homebrew/bin/pnpm
bun: 1.2.23 - /Users/andy/.bun/bin/bun
Deno: 2.3.3 - /opt/homebrew/bin/deno
npmPackages:
@cloudflare/vite-plugin: ^1.13.10 => 1.13.10
wrangler: ^4.42.0 => 4.42.0

Please provide a link to a minimal reproduction

No response

Describe the Bug

When deploying a Vite-built Worker via vite build --mode live && wrangler deploy, the Worker deploys successfully, but I get a warning:

▲ [WARNING] Multiple environments are defined in the Wrangler configuration file, but no target environment was specified for the deploy command.
  To avoid unintentional changes to the wrong environment, it is recommended to explicitly specify the target environment using the `-e|--env` flag.
  If your intention is to use the top-level environment of your configuration simply pass an empty string to the flag to target such environment. For example `--env=""`.

If I pass in --env (i.e. vite build --mode live && wrangler deploy --env live), the build fails with the following error:

✘ [ERROR] Processing dist/ace_apps_user/wrangler.json configuration:
    - You have specified the environment "near", but are using a redirected configuration, produced by a build tool such as Vite.
      You need to set the environment in your build tool, rather than via Wrangler.
      For example, if you are using Vite, refer to these docs: https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/

Is the warning redundant when using Vite to build and deploy Workers?

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions