Skip to content

Plugin and runtime reference ​

Build entrypoints ​

These entrypoints export the default matrix() factory for the corresponding host. See build tool integration for setup, Electron scopes, and transform boundaries.

EntrypointHost
@xova/matrix/viteVite / electron-vite
@xova/matrix/rollupRollup
@xova/matrix/webpackWebpack
@xova/matrix/esbuildesbuild

The default virtual module is virtual:matrix/runtime; with a scope it is virtual:matrix/runtime/<scope>. The build plugin implements these modules; they are not directly resolvable files in the npm package.

Plugin options ​

Pass these options to matrix() from the Vite, Rollup, Webpack, or esbuild entrypoint. They belong in the host configuration, not in matrix.config.ts.

OptionDefaultPurpose
envPrefixVITE_ outside Vite; Vite uses its resolved prefixString or string array of public prefixes. An explicit plugin option configures Vite's prefix too; MATRIX_ is always added. Prefixes control exposure, not whether values reach the child process.
scopeNo scopeModule/type isolation key, using only letters, digits, underscores, or hyphens. Use one scope per compilation.
inlinetrueReplace supported static reads with literals; false keeps only the immutable virtual runtime integration.
typesEnabled, except automatic generation in Vitestfalse disables declaration generation; true enables it; { output: '...' } selects an output path relative to the generation root. Vite uses its resolved project root; other adapters use the current working directory.

With a custom type output, include that file in the consuming project's tsconfig.json. Default declarations are .matrix/types/matrix-runtime.d.ts, or .matrix/types/matrix-runtime-<scope>.d.ts for a scope.

Runtime fields ​

FieldMeaning
environmentSelected Matrix configuration environment, such as staging or qa.
targetSelected Matrix target, such as build.
nodeEnvResolved Node process mode, distinct from the configuration environment.
isDevelopment, isProduction, isTestMode flags derived from nodeEnv.
variant, projectVariant and project keys for the build context.
productProduct key, id, name, slug, optional appId, and optional version.
configPublic environment fields with prefixes removed and names camel-cased; VITE_API_BASE becomes apiBase. Schema fields retain their declared scalar types.

Only expose values intended to be present in the application bundle. A schema does not make a secret safe to publish. Matrix does not replace the application framework's own environment system.