angular/angular-cli · warning
Prebundling has been configured but will not be used because
Error message
Prebundling has been configured but will not be used because caching has been disabled.
What it means
The dev-server's esbuild prebundling (Vite dependency preoptimization) requires persistent build caching. When `prebundle` is enabled (the default) but caching is disabled in the project's cache options, prebundling silently degrades and this warning explains why. Raised in `normalizeOptions` when the resolved builder is esbuild-based.
Source
Thrown at packages/angular_devkit/build_angular/src/builders/dev-server/options.ts:69
const projectRoot = path.join(workspaceRoot, (projectMetadata.root as string | undefined) ?? '');
const cacheOptions = normalizeCacheOptions(projectMetadata, workspaceRoot);
// Target specifier defaults to the current project's build target using a development configuration
const buildTargetSpecifier = options.buildTarget ?? `::development`;
const buildTarget = targetFromTargetString(buildTargetSpecifier, projectName, 'build');
// Get the application builder options.
const browserBuilderName = await context.getBuilderNameForTarget(buildTarget);
const rawBuildOptions = await context.getTargetOptions(buildTarget);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const buildOptions = (await context.validateOptions(rawBuildOptions, browserBuilderName)) as any;
const optimization = normalizeOptimization(buildOptions.optimization);
if (options.prebundle !== false && isEsbuildBased(browserBuilderName)) {
if (!cacheOptions.enabled) {
// Warn if the initial options provided by the user enable prebundling but caching is disabled
logger.warn(
'Prebundling has been configured but will not be used because caching has been disabled.',
);
} else if (optimization.scripts) {
// Warn if the initial options provided by the user enable prebundling but script optimization is enabled.
logger.warn(
'Prebundling has been configured but will not be used because scripts optimization is enabled.',
);
}
}
let inspect: false | { host?: string; port?: number } = false;
const inspectRaw = options.inspect;
if (inspectRaw === true || inspectRaw === '' || inspectRaw === 'true') {
inspect = {
host: undefined,
port: undefined,
};
} else if (typeof inspectRaw === 'string' && inspectRaw !== 'false') {View on GitHub (pinned to bb72145f9a)
Solutions
- Enable caching in angular.json: set `"cli": { "cache": { "enabled": true } }` under the project
- Explicitly set `"prebundle": false` in the serve options if you intentionally want no prebundling
- Set `NG_BUILD_CACHE=enabled` environment variable if cache config is controlled via env
- Ignore the warning if cold-start performance loss is acceptable
Example fix
// before (angular.json)
"cli": { "cache": { "enabled": false } }
// after
"cli": { "cache": { "enabled": true } } Defensive patterns
Strategy: validation
Validate before calling
// validate angular.json before serving
const cacheEnabled = workspace.projects[p].architect?.build?.options?.cache?.enabled
?? workspace.cli?.cache?.enabled;
const prebundle = serveOptions.prebundle !== false;
if (prebundle && !cacheEnabled) {
console.warn('Prebundling will be skipped: enable cache or set prebundle:false.');
} Type guard
function prebundlingEffective(opts: { prebundle?: boolean }, cache: { enabled: boolean }): boolean {
return opts.prebundle !== false && cache.enabled;
} Prevention
- Keep CLI caching enabled in development workspaces
- Set prebundle:false explicitly when disabling cache so intent is documented
- Check NG_BUILD_CACHE env overrides in CI containers
- Revisit cache settings when upgrading Angular versions
When it happens
Trigger: Running `ng serve` with an esbuild-based builder while `cache` is disabled (e.g. `"cache": false` in angular.json or `NG_BUILD_CACHE=off`) and `prebundle` not explicitly set to false.
Common situations: Projects that disabled caching due to disk-space or CI concerns, or older angular.json configs created before prebundling existed, now served with the Vite-based dev server.
Related errors
- The "application" and "browser-esbuild" builders do not supp
- The "publicHost" option will not be used because it is not s
- Prebundling has been configured but will not be used because
- Prebundling has been configured but will not be used because
- Only the "application" and "browser-esbuild" builders suppor
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/9f81a9bd0d0ab6ab.
Report an issue: GitHub.