vercel/next.js · error · Error

Environment doesn't support lazy compilation (requires Event

Error message

Environment doesn't support lazy compilation (requires EventSource)

What it means

Feature-detection guard at module load of webpack's lazy-compilation runtime: the browser environment lacks a functional EventSource constructor, which the lazy-compilation backchannel requires. Because the module throws at evaluation time, any build using lazy compilation fails as soon as this chunk loads in the unsupported environment.

Source

Thrown at packages/next/src/bundles/webpack/packages/lazy-compilation-web.js:6

/* global __resourceQuery */

"use strict";

if (typeof EventSource !== "function") {
	throw new Error(
		"Environment doesn't support lazy compilation (requires EventSource)"
	);
}

var urlBase = decodeURIComponent(__resourceQuery.slice(1));
/** @type {EventSource | undefined} */
var activeEventSource;
var activeKeys = new Map();
var errorHandlers = new Set();

var updateEventSource = function updateEventSource() {
	if (activeEventSource) activeEventSource.close();
	if (activeKeys.size) {
		activeEventSource = new EventSource(
			urlBase + Array.from(activeKeys.keys()).join("@")
		);
		/**
		 * @this {EventSource}

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Use a browser/environment that supports EventSource, or disable experimental lazy compilation for client components.
Defensive patterns

Strategy: validation

When it happens

Trigger: Lazy compilation client code runs in an environment without EventSource support.

Common situations: Experimental lazy compilation is enabled but the browser or test environment lacks EventSource.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/8cc61c0668d38a1b. Report an issue: GitHub.