webpack/webpack · error · TypeError

Compiler.getInfrastructureLogger(name) called with a functio

Error message

Compiler.getInfrastructureLogger(name) called with a function not returning a name

What it means

Error "Compiler.getInfrastructureLogger(name) called with a function not returning a name" thrown in webpack/webpack.

Source

Thrown at lib/Compiler.js:417

	}

	/**
	 * Gets infrastructure logger.
	 * @param {string | (() => string)} name name of the logger, or function called once to get the logger name
	 * @returns {Logger} a logger with that name
	 */
	getInfrastructureLogger(name) {
		if (!name) {
			throw new TypeError(
				"Compiler.getInfrastructureLogger(name) called without a name"
			);
		}
		return new Logger(
			(type, args) => {
				if (typeof name === "function") {
					name = name();
					if (!name) {
						throw new TypeError(
							"Compiler.getInfrastructureLogger(name) called with a function not returning a name"
						);
					}
				}
				if (
					this.hooks.infrastructureLog.call(name, type, args) === undefined &&
					this.infrastructureLogger !== undefined
				) {
					this.infrastructureLogger(name, type, args);
				}
			},
			(childName) => {
				if (typeof name === "function") {
					if (typeof childName === "function") {
						return this.getInfrastructureLogger(() => {
							if (typeof name === "function") {
								name = name();
								if (!name) {

View on GitHub (pinned to 318421ea8a)

Solutions

  1. Ensure the function passed to compiler.getInfrastructureLogger returns a non-empty string name, or pass the name string directly.

When it happens

Trigger: Thrown at lib/Compiler.js:417 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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