webpack/webpack · error · Error

id was renamed to ids and type changed to string[]

Error message

id was renamed to ids and type changed to string[]

What it means

HarmonyImportSpecifierDependency.id was a single-string property that webpack replaced with the ids array (string[]) to support nested/member export specifiers. The getter is kept only as a deprecation guard (marked TODO webpack 6 remove) and throws unconditionally to surface old API usage. Accessing .id means the calling code predates the multi-id refactor and will produce wrong results even if it returned.

Source

Thrown at lib/dependencies/HarmonyImportSpecifierDependency.js:118

		/** @type {undefined | boolean | string} */
		this.shorthand = undefined;
		/** @type {undefined | boolean} */
		this.asiSafe = undefined;
		/** @type {UsedByExports | undefined} */
		this.usedByExports = undefined;
		/** @type {DestructuringAssignmentProperties | undefined} */
		this.referencedPropertiesInDestructuring = undefined;
		/** @type {DependencyGuard[] | undefined} */
		this.branchGuards = undefined;
	}

	// TODO webpack 6 remove
	/**
	 * Returns id.
	 * @deprecated
	 */
	get id() {
		throw new Error("id was renamed to ids and type changed to string[]");
	}

	// TODO webpack 6 remove
	/**
	 * Returns id.
	 * @deprecated
	 */
	getId() {
		throw new Error("id was renamed to ids and type changed to string[]");
	}

	// TODO webpack 6 remove
	/**
	 * Updates id.
	 * @deprecated
	 */
	setId() {
		throw new Error("id was renamed to ids and type changed to string[]");

View on GitHub (pinned to 318421ea8a)

Solutions

  1. Replace dependency.id with dependency.ids (string[]) and adjust consuming code to handle the array.
  2. Use dependency.getIds(moduleGraph) when you need the resolved ids (it accounts for module-graph rewrites).
  3. Upgrade or replace the third-party plugin that still references the old .id API.

Example fix

// before
const name = dep.id;
// after
const names = dep.ids;
const resolved = dep.getIds(moduleGraph);
Defensive patterns

Strategy: type-guard

Validate before calling

if (dep instanceof HarmonyImportSpecifierDependency && !('id' in HarmonyImportSpecifierDependency.prototype && Object.getOwnPropertyDescriptor(HarmonyImportSpecifierDependency.prototype, 'id').get)) {
  // safe: id is gone; use ids
}
// simpler: lint for `.id` on harmony specifier deps

Type guard

/** @param {object} dep @returns {dep is { ids: string[] }} */
function hasIds(dep) {
  return Array.isArray(dep.ids);
}

Prevention

When it happens

Trigger: A custom plugin, loader, or webpack-internals fork reads dependency.id on a harmony import specifier dependency produced by the ES module parser. Also triggered by third-party tooling (bundle analyzers, instrumentation) that walks the dependency graph using the pre-5.x field name.

Common situations: Upgrading webpack major version while a plugin has not been updated; a private fork of webpack that still references id; static-analysis tooling built against an older webpack types.d.ts.

Related errors


AI-assisted analysis of webpack/webpack@318421ea8a (2026-08-03). Data as JSON: /data/errors/622c2d5d81f3f09c.json. Report an issue: GitHub.