Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): allow function in filename while …
Browse files Browse the repository at this point in the history
…changing the name of compiling chunks

Fixes #17087

(cherry picked from commit 14dc4fb)
  • Loading branch information
sacgrover authored and dgp1130 committed Feb 26, 2020
1 parent 35ad92c commit 9bbb6ed
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
// tslint:disable-next-line: no-any
(compilation.mainTemplate.hooks as any).assetPath.tap(
'build-angular',
(filename: string, data: ChunkData) => {
const isMap = filename && filename.endsWith('.map');
(filename: string | ((data: ChunkData) => string), data: ChunkData) => {
const assetName = typeof filename === 'function' ? filename(data) : filename;
const isMap = assetName && assetName.endsWith('.map');

return data.chunk && data.chunk.name === 'polyfills-es5'
? `polyfills-es5${hashFormat.chunk}.js${isMap ? '.map' : ''}`
: filename;
: assetName;
},
);
});
Expand Down

0 comments on commit 9bbb6ed

Please sign in to comment.