Skip to content

Commit d74e7e3

Browse files
valorkinalan-agius4
authored andcommitted
fix(@angular-devkit/build-angular): fix webpack 5 deprecation warning for chunk.push
1 parent 5e293f0 commit d74e7e3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/angular_devkit/build_angular/src/webpack/plugins/scripts-webpack-plugin.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Compiler, loader } from 'webpack';
1212
import { CachedSource, ConcatSource, OriginalSource, RawSource, Source } from 'webpack-sources';
1313
import { interpolateName } from 'loader-utils';
1414
import * as path from 'path';
15+
import { isWebpackFiveOrHigher } from '../../utils/webpack-version';
1516

1617
const Chunk = require('webpack/lib/Chunk');
1718
const EntryPoint = require('webpack/lib/Entrypoint');
@@ -72,7 +73,11 @@ export class ScriptsWebpackPlugin {
7273
chunk.rendered = !cached;
7374
chunk.id = this.options.name;
7475
chunk.ids = [chunk.id];
75-
chunk.files.push(filename);
76+
if (isWebpackFiveOrHigher()) {
77+
chunk.files.add(filename);
78+
} else {
79+
chunk.files.push(filename);
80+
}
7681

7782
const entrypoint = new EntryPoint(this.options.name);
7883
entrypoint.pushChunk(chunk);

0 commit comments

Comments
 (0)