Skip to content

Commit c08c5bf

Browse files
committed
build: update Webpack to v5.101.0
Updates Webpack to version 5.101.0. Also adds runtime assertions to ensure that a Webpack compiler instance is always created when expected.
1 parent 9ff488b commit c08c5bf

File tree

8 files changed

+64
-55
lines changed

8 files changed

+64
-55
lines changed

goldens/public-api/angular_devkit/build_webpack/index.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export type WebpackDevServerFactory = typeof WebpackDevServer;
6565
// @public (undocumented)
6666
export interface WebpackFactory {
6767
// (undocumented)
68-
(config: webpack.Configuration): Observable<webpack.Compiler> | webpack.Compiler;
68+
(config: webpack.Configuration): Observable<webpack.Compiler | null> | webpack.Compiler | null;
6969
}
7070

7171
// @public (undocumented)

packages/angular_devkit/build_angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"terser": "5.43.1",
5656
"tree-kill": "1.2.2",
5757
"tslib": "2.8.1",
58-
"webpack": "5.100.2",
58+
"webpack": "5.101.0",
5959
"webpack-dev-middleware": "7.4.2",
6060
"webpack-dev-server": "5.2.2",
6161
"webpack-merge": "6.0.1",

packages/angular_devkit/build_angular/src/tools/webpack/plugins/karma/karma.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { createConsoleLogger } from '@angular-devkit/core/node';
1818
import { logging } from '@angular-devkit/core';
1919
import { BuildOptions } from '../../../../utils/build-options';
2020
import { normalizeSourceMaps } from '../../../../utils/index';
21+
import assert from 'node:assert';
2122

2223
const KARMA_APPLICATION_PATH = '_karma_webpack_';
2324

@@ -142,6 +143,8 @@ const init: any = (config: any, emitter: any) => {
142143
callback?.();
143144
}
144145

146+
assert(compiler, 'Webpack compiler factory did not return a compiler instance.');
147+
145148
compiler.hooks.invalid.tap('karma', () => handler());
146149
compiler.hooks.watchRun.tapAsync('karma', (_: any, callback: () => void) => handler(callback));
147150
compiler.hooks.run.tapAsync('karma', (_: any, callback: () => void) => handler(callback));

packages/angular_devkit/build_webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"devDependencies": {
2323
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
2424
"@ngtools/webpack": "workspace:0.0.0-PLACEHOLDER",
25-
"webpack": "5.100.2",
25+
"webpack": "5.101.0",
2626
"webpack-dev-server": "5.2.2"
2727
},
2828
"peerDependencies": {

packages/angular_devkit/build_webpack/src/builders/webpack-dev-server/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import { Builder, BuilderContext, createBuilder } from '@angular-devkit/architect';
10+
import assert from 'node:assert';
1011
import { resolve as pathResolve } from 'node:path';
1112
import { Observable, from, isObservable, of, switchMap } from 'rxjs';
1213
import webpack from 'webpack';
@@ -72,6 +73,8 @@ export function runWebpackDevServer(
7273
switchMap(
7374
(webpackCompiler) =>
7475
new Observable<DevServerBuildOutput>((obs) => {
76+
assert(webpackCompiler, 'Webpack compiler factory did not return a compiler instance.');
77+
7578
const devServerConfig = options.devServerConfig || config.devServer || {};
7679
devServerConfig.host ??= 'localhost';
7780

packages/angular_devkit/build_webpack/src/builders/webpack/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import { Builder, BuilderContext, BuilderOutput, createBuilder } from '@angular-devkit/architect';
10+
import assert from 'node:assert';
1011
import { resolve as pathResolve } from 'node:path';
1112
import { Observable, from, isObservable, of, switchMap } from 'rxjs';
1213
import webpack from 'webpack';
@@ -19,7 +20,7 @@ export interface WebpackLoggingCallback {
1920
(stats: webpack.Stats, config: webpack.Configuration): void;
2021
}
2122
export interface WebpackFactory {
22-
(config: webpack.Configuration): Observable<webpack.Compiler> | webpack.Compiler;
23+
(config: webpack.Configuration): Observable<webpack.Compiler | null> | webpack.Compiler | null;
2324
}
2425

2526
export type BuildResult = BuilderOutput & {
@@ -64,6 +65,8 @@ export function runWebpack(
6465
switchMap(
6566
(webpackCompiler) =>
6667
new Observable<BuildResult>((obs) => {
68+
assert(webpackCompiler, 'Webpack compiler factory did not return a compiler instance.');
69+
6770
const callback = (err?: Error | null, stats?: webpack.Stats) => {
6871
if (err) {
6972
return obs.error(err);

packages/ngtools/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"@angular/compiler": "20.2.0-next.2",
3131
"@angular/compiler-cli": "20.2.0-next.2",
3232
"typescript": "5.8.3",
33-
"webpack": "5.100.2"
33+
"webpack": "5.101.0"
3434
}
3535
}

0 commit comments

Comments
 (0)