Secrets (3)

Last updated Apr 23, 2026 are typically used for storing sensitive information such as API keys and auth tokens. For deployed Workers, they are set via the dashboard or Wrangler CLI.

In local development, secrets can be provided to your Worker by using a .dev.vars file. If you are using Cloudflare Environments then the relevant .dev.vars file will be selected. For example, CLOUDFLARE_ENV=staging vite dev will load .dev.vars.staging if it exists and fall back to .dev.vars.

Note

The vite build command copies the relevant .dev.vars file to the output directory. This is only used when running vite preview and is not deployed with your Worker.

Was this helpful?

YesNo

On this page

Secrets (3) - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers/vite-plugin/reference/secrets/#page","headline":"Secrets","description":"Using secrets with the Vite plugin","url":"https://developers.cloudflare.com/workers/vite-plugin/reference/secrets/","inLanguage":"en","image":"https://developers.cloudflare.com/workers/vite-plugin/reference/secrets/og.png?v=60a3b999abcd3095","dateModified":"2026-04-23","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Static assets and the Vite plugin title: Static Assets image: https://developers.cloudflare.com/workers/vite-plugin/reference/static-assets/og.png?v=acb320fcaf3019ec


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workers/llms.txt
Use this file to discover all available pages before exploring further.