Skip to content

Commit 95b3384

Browse files
clydinfilipesilva
authored andcommitted
refactor(@angular-devkit/build-webpack): cleanup type usage
This change removes some unneeded casts and provides support for building against Webpack 5. Webpack 5 typings currently do not contain certain types (for example, `Compiler.Handler`). Webpack 5 also uses `Set` in many places instead of arrays.
1 parent 76b1b53 commit 95b3384

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/angular_devkit/build_webpack/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export function getEmittedFiles(compilation: webpack.compilation.Compilation): E
2222
const files: EmittedFiles[] = [];
2323

2424
// adds all chunks to the list of emitted files such as lazy loaded modules
25-
for (const chunk of compilation.chunks as webpack.compilation.Chunk[]) {
26-
for (const file of chunk.files as string[]) {
25+
for (const chunk of compilation.chunks as Iterable<webpack.compilation.Chunk>) {
26+
for (const file of chunk.files) {
2727
files.push({
2828
// The id is guaranteed to exist at this point in the compilation process
2929
// tslint:disable-next-line: no-non-null-assertion

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function runWebpack(
5252

5353
return createWebpack(config).pipe(
5454
switchMap(webpackCompiler => new Observable<BuildResult>(obs => {
55-
const callback: webpack.Compiler.Handler = (err, stats) => {
55+
const callback = (err: Error | undefined, stats: webpack.Stats) => {
5656
if (err) {
5757
return obs.error(err);
5858
}

0 commit comments

Comments
 (0)