Skip to main content


You can access environment variables set in a .env file in your project root using bud.env.


Environment variables are sourced from .env files recursively, starting with the project root directory. The closer the file is to the project root, the higher priority it has.

So, if you have an .env file in your project root and another in the parent directory, and both contain a value for the same key, the value from the project root will be used.


bud.js supports expansion of environment variables. For example:


Public variables

Any environment variables that are prefixed with PUBLIC_ will be available to your application code. When using variable values in your application you must remove the PUBLIC_ prefix.

For example, setting PUBLIC_API_URL:


Means API_URL can be used in your application code:

const request = fetch(`${API_URL}/endpoint`)

The replacement is static and happens at build time. It is not the same as defining a global.

For example, attempting to redefine it will cause a type error:

* Don't do this
API_URL = ''

Configurable environment variables

VariableDescriptionRelated argument
BUD_BROWSERSLIST_UPDATESet to false in order to disable automatic updating of the browserslist database.--browserslist-update
BUD_CACHEEnable or disable bud.js caching--cache
BUD_DEVTOOLThe devtool to use for builds--devtool
BUD_ESMEnable or disable bud.js ESM output (experimental)--esm
BUD_HASHEnable or disable output file hashing--hash
BUD_HTMLEnable HTML templating; set to a string to specify the path to a template--html
BUD_HOTEnable or disable bud.js hot reloading--hot
BUD_IMMUTABLEEnable or disable automated updates of dependencies when using remote modules--immutable
BUD_LAZYEnable or disable lazy compilation of modules in development--lazy
BUD_MINIMIZEEnable or disable code minimization--minimize
BUD_PATH_BASEThe path to the root directory of the bud.js project--basedir
BUD_PATH_STORAGEThe path to the directory where bud.js stores its data and caches--storage
BUD_PATH_INPUTThe path to the directory where bud.js looks for source files--input
BUD_PATH_OUTPUTThe path to the directory where bud.js outputs build files--output
BUD_PATH_PUBLICDirectory to prepend to asset URLs (if assets are not served from web root)--publicPath
BUD_PROXY_URLThe URL of the proxy server to use--proxy
BUD_RUNTIMEEnable or disable generation of a runtime module--runtime
BUD_SPLIT_CHUNKSEnable or disable splitting of modules into discrete chunks (vendor, app, etc.)--split-chunks


You can verify what environment variables are available to bud.js using the bud env command:

npm run bud env