Skip to main content

Crate oj_config

Crate oj_config 

Source
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§

BuildConfig
LibConfig
OjConfig
PreviewConfig
ProxyOptions
ProxyRewrite
ResolveConfig
ServerConfig

Enums§

ConfigError
ProxyEntry
"/api": "http://localhost:3000" or "/api": { target, changeOrigin, ws, rewrite }.

Functions§

config_defines
Top-level config.define as (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>.define as (name, js-expression) pairs: the per-environment overrides of the Vite Environment API.
load
Load the config from root, or OjConfig::default() if none exists.
resolve_alias
resolve.alias entries (find, replacement) for an environment. Precedence: environments.<name>.resolve.alias merged over top-level resolve.alias. Returns (find, replacement) pairs for the resolver.
resolve_conditions
Package exports/imports condition names for an environment. Precedence: environments.<name>.resolve.conditions > top-level resolve.conditions > the built-in default (browser for client, node for ssr).