dotnet/runtime · error · Error

Configuration environment variable is not defined

Error message

Configuration environment variable is not defined

What it means

rollup.config.defines.js requires the Configuration environment variable (Debug/Release) so it can compute the `configuration` export used by the rest of the rollup pipeline (file naming, conditional debug-only includes, banner). Undefined Configuration would yield an ambiguous build, so the module refuses to load.

Source

Thrown at src/native/rollup.config.defines.js:12

//! Licensed to the .NET Foundation under one or more agreements.
//! The .NET Foundation licenses this file to you under the MIT license.

/* eslint-disable no-console */

import gitCommitInfo from "git-commit-info";

if (process.env.ContinuousIntegrationBuild === undefined) {
    throw new Error("ContinuousIntegrationBuild environment variable is not defined");
}
if (process.env.Configuration === undefined) {
    throw new Error("Configuration environment variable is not defined");
}
if (process.env.ProductVersion === undefined) {
    throw new Error("ProductVersion environment variable is not defined");
}

export const configuration = process.env.Configuration !== "Release" && process.env.Configuration !== "RELEASE" ? "Debug" : "Release";
export const runtimeFlavor = process.env.RuntimeFlavor || "CoreCLR";
export const productVersion = process.env.ProductVersion;
export const isContinuousIntegrationBuild = process.env.ContinuousIntegrationBuild === "true" ? true : false;
export const staticLibDestination = process.env.StaticLibDestination || `../../artifacts/obj/native/net${productVersion}-browser-${configuration}-wasm/lib`;

console.log(`Rollup configuration: Configuration=${configuration}, RuntimeFlavor=${runtimeFlavor}, ProductVersion=${productVersion}, ContinuousIntegrationBuild=${isContinuousIntegrationBuild}`);

export const banner = "//! Licensed to the .NET Foundation under one or more agreements.\n//! The .NET Foundation licenses this file to you under the MIT license.\n//! This is generated file, see src/native/rollup.config.js\n\n";
export const banner_dts = banner + "//! This is not considered public API with backward compatibility guarantees. \n";
export const keep_classnames = /(ManagedObject|ManagedError|Span|ArraySegment)/;
export const keep_fnames = /(dotnetUpdateInternals|dotnetUpdateInternalsSubscriber)/;
export const reserved = [

View on GitHub (pinned to 60108ba66e)

Solutions

  1. Run the build via the project's MSBuild target, which sets Configuration from -c/--configuration.
  2. Set Configuration explicitly: `Configuration=Debug` (or `Release`) when invoking rollup.
  3. Persist the variable in your dev shell rc or CI pipeline for this repo.

Example fix

# before
rollup -c  # throws Configuration not defined

# after
Configuration=Debug ContinuousIntegrationBuild=false ProductVersion=8.0.0 rollup -c
Defensive patterns

Strategy: validation

Validate before calling

if (process.env.Configuration === undefined) {
  throw new Error('Set Configuration=Debug|Release before running rollup');
}

Type guard

function hasConfigurationEnv(env: NodeJS.ProcessEnv): boolean {
  return env.Configuration !== undefined;
}

Prevention

When it happens

Trigger: Running the rollup bundling step with Configuration unset. The guard at rollup.config.defines.js:11-13 fires at module import time.

Common situations: Local dev running rollup directly without going through MSBuild. A wrapper script that forwards only some env vars. Switching terminals and losing a previously-exported var.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/349949cfca5bdeeb. Report an issue: GitHub.