Skip to content

Commit df172bd

Browse files
alan-agius4alexeagle
authored andcommitted
fix(@ngtools/webpack): output consistent filename
At the moment when having namedChunks file names are different between JIT and AOT builds . AOT will will output something like ``` customers-customers-module-ngfactory.9b8b989df2e32e5cadac.js ``` while JIT will output ``` customers-customers-module.js ``` This PR aligns the output file name
1 parent 583024d commit df172bd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/angular_devkit/build_angular/test/browser/lazy-module_spec_large.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe('Browser Builder lazy modules', () => {
9797
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
9898
tap(() => {
9999
expect(host.scopedSync()
100-
.exists(join(outputPath, 'lazy-lazy-module-ngfactory.js'))).toBe(true);
100+
.exists(join(outputPath, 'lazy-lazy-module.js'))).toBe(true);
101101
}),
102102
).toPromise().then(done, done.fail);
103103
});
@@ -256,7 +256,7 @@ describe('Browser Builder lazy modules', () => {
256256
runTargetSpec(host, browserTargetSpec, overrides, DefaultTimeout * 2).pipe(
257257
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
258258
tap(() => expect(host.scopedSync()
259-
.exists(join(outputPath, 'src-app-lazy-lazy-module-ngfactory.js')))
259+
.exists(join(outputPath, 'src-app-lazy-lazy-module.js')))
260260
.toBe(true)),
261261
).toPromise().then(done, done.fail);
262262
});

packages/ngtools/webpack/src/angular_compiler_plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ export class AngularCompilerPlugin {
721721
const modulePath = this._lazyRoutes[key];
722722
const importPath = key.split('#')[0];
723723
if (modulePath !== null) {
724-
const name = importPath.replace(/(\.ngfactory)?\.(js|ts)$/, '');
724+
const name = importPath.replace(/(\.ngfactory)?(\.(js|ts))?$/, '');
725725

726726
return new this._contextElementDependencyConstructor(modulePath, name);
727727
} else {

0 commit comments

Comments
 (0)