Skip to content

Commit

Permalink
fix(@ngtools/webpack): output consistent filename
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alan-agius4 authored and alexeagle committed Oct 15, 2018
1 parent 583024d commit df172bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('Browser Builder lazy modules', () => {
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => {
expect(host.scopedSync()
.exists(join(outputPath, 'lazy-lazy-module-ngfactory.js'))).toBe(true);
.exists(join(outputPath, 'lazy-lazy-module.js'))).toBe(true);
}),
).toPromise().then(done, done.fail);
});
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('Browser Builder lazy modules', () => {
runTargetSpec(host, browserTargetSpec, overrides, DefaultTimeout * 2).pipe(
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
tap(() => expect(host.scopedSync()
.exists(join(outputPath, 'src-app-lazy-lazy-module-ngfactory.js')))
.exists(join(outputPath, 'src-app-lazy-lazy-module.js')))
.toBe(true)),
).toPromise().then(done, done.fail);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ export class AngularCompilerPlugin {
const modulePath = this._lazyRoutes[key];
const importPath = key.split('#')[0];
if (modulePath !== null) {
const name = importPath.replace(/(\.ngfactory)?\.(js|ts)$/, '');
const name = importPath.replace(/(\.ngfactory)?(\.(js|ts))?$/, '');

return new this._contextElementDependencyConstructor(modulePath, name);
} else {
Expand Down

0 comments on commit df172bd

Please sign in to comment.