Skip to content

Commit

Permalink
fix(@angular-devkit/build-webpack): add dot to file extension in emit…
Browse files Browse the repository at this point in the history
…ted files
  • Loading branch information
Alan Agius authored and alexeagle committed Apr 10, 2019
1 parent 32a096f commit 6dac818
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/angular_devkit/build_webpack/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import * as path from 'path';
import * as webpack from 'webpack';

export interface EmittedFiles {
Expand All @@ -16,7 +17,6 @@ export interface EmittedFiles {
}

export function getEmittedFiles(compilation: webpack.compilation.Compilation): EmittedFiles[] {
const getExtension = (file: string) => file.split('.').reverse()[0];
const files: EmittedFiles[] = [];

for (const chunk of Object.values(compilation.chunks)) {
Expand All @@ -26,7 +26,7 @@ export function getEmittedFiles(compilation: webpack.compilation.Compilation): E
};

for (const file of chunk.files) {
files.push({ ...entry, file, extension: getExtension(file) } as EmittedFiles);
files.push({ ...entry, file, extension: path.extname(file) } as EmittedFiles);
}
}

Expand All @@ -38,7 +38,7 @@ export function getEmittedFiles(compilation: webpack.compilation.Compilation): E

files.push({
file,
extension: getExtension(file),
extension: path.extname(file),
initial: false,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Dev Server Builder', () => {
name: 'main',
initial: true,
file: 'bundle.js',
extension: 'js',
extension: '.js',
});
await run.stop();
}, 30000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Webpack Builder basic test', () => {
name: 'main',
initial: true,
file: 'bundle.js',
extension: 'js',
extension: '.js',
});

await run.stop();
Expand Down Expand Up @@ -95,8 +95,8 @@ describe('Webpack Builder basic test', () => {

expect(output.success).toBe(true);
expect(output.emittedFiles).toContain(
{ name: 'main', initial: true, file: 'main.js', extension: 'js' },
{ name: 'polyfills', initial: true, file: 'polyfills.js', extension: 'js' },
{ name: 'main', initial: true, file: 'main.js', extension: '.js' },
{ name: 'polyfills', initial: true, file: 'polyfills.js', extension: '.js' },
);

await run.stop();
Expand Down

0 comments on commit 6dac818

Please sign in to comment.