Expand description
Loads oj.config.{ts,js,mjs,json}.
.json is parsed directly. .ts/.js/.mjs have their TypeScript types
stripped with oxc, then evaluate in an embedded QuickJS engine (no Node)
with defineConfig and process.env shimmed, capturing the default
export and reading it back as JSON. Computed values, ternaries, and
process.env all work; the exported object must be JSON-serializable
(functions/plugins are out of scope until the plugin system).
Structs§
Enums§
- Config
Error - Proxy
Entry "/api": "http://localhost:3000"or"/api": { target, changeOrigin, ws, rewrite }.
Functions§
- config_
defines - Top-level
config.defineas(name, js-expression)pairs, applied in every environment. - environment_
build_ bool - A boolean under
environments.<name>.build.<field>(e.g.minify,sourcemap), if set: the per-environment build-output override. - environment_
defines config.environments.<name>.defineas(name, js-expression)pairs: the per-environment overrides of the Vite Environment API.- load
- Load the config from
root, orOjConfig::default()if none exists. - resolve_
alias resolve.aliasentries (find,replacement) for an environment. Precedence:environments.<name>.resolve.aliasmerged over top-levelresolve.alias. Returns(find, replacement)pairs for the resolver.- resolve_
conditions - Package
exports/importscondition names for an environment. Precedence:environments.<name>.resolve.conditions> top-levelresolve.conditions> the built-in default (browser forclient, node forssr).