Repository navigation
Closed
Labels
area: bazelIssues related to the published `@angular/bazel` build rulesarea: coreIssues related to the framework runtime
Milestone
Description
This commit
d20877b#diff-c68ccdefc54b5e3375135dddaa34d46c
causes ngc to produce a summary file
{"__symbol":110,"name":"ɵEmptyOutletComponent","filePath":"./router"},
{"__symbol":111,"name":"ApplicationRef","filePath":"@angular/core"},
{"__symbol":112,"name":"SystemJsNgModuleLoader","filePath":"@angular/core"},
{"__symbol":113,"name":"ɵflatten","filePath":"./router"},
{"__symbol":114,"name":"ɵEmptyOutletComponentNgFactory","filePath":"./router.ngfactory"},
{"__symbol":115,"name":"View_ɵEmptyOutletComponent_0","filePath":"./router.ngfactory"},
{"__symbol":116,"name":"RenderType_ɵEmptyOutletComponent","filePath":"./router.ngfactory"}]}
to point to a ngfactory in a way that breaks the compile:
angular/angular-bazel-example#154
ERROR: /home/circleci/ng/src/hello-world/BUILD.bazel:13:1: Compiling Angular templates (ngc) //src/hello-world:hello-world failed (Exit 1)
: Error: Could not resolve ./router.ngfactory from /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/execroot/angular_bazel_example/node_modules/@angular/router/router.d.ts
at TsCompilerAotCompilerTypeCheckHostAdapter.fromSummaryFileName (/home/packages/compiler-cli/src/transformers/compiler_host.ts:274:13)
at AotSummaryResolver.fromSummaryFileName (/execroot/angular/packages/compiler/src/aot/summary_resolver.ts:64:22)
at /execroot/angular/packages/compiler/src/aot/summary_serializer.ts:441:34
at Array.map (<anonymous>)
at FromJsonDeserializer.deserialize (/execroot/angular/packages/compiler/src/aot/summary_serializer.ts:439:33)
at deserializeSummaries (/execroot/angular/packages/compiler/src/aot/summary_serializer.ts:61:23)
at AotSummaryResolver._loadSummaryFile (/execroot/angular/packages/compiler/src/aot/summary_resolver.ts:118:13)
at AotSummaryResolver.resolveSummary (/execroot/angular/packages/compiler/src/aot/summary_resolver.ts:73:12)
at StaticSymbolResolver._resolveSymbolFromSummary (/execroot/angular/packages/compiler/src/aot/static_symbol_resolver.ts:234:42)
at StaticSymbolResolver.resolveSymbol (/execroot/angular/packages/compiler/src/aot/static_symbol_resolver.ts:85:36)
Reacted by SteveRob2k, Daniel Wulff and Максим Иванов
Metadata
Metadata
Assignees
Labels
area: bazelIssues related to the published `@angular/bazel` build rulesarea: coreIssues related to the framework runtime
Activity
alexeagle commentedon Jun 14, 2018
@alxhub explains: this router class is the first time we have an
@Componentinside the@angularpackages.There's a discrepancy between the generated
ngfactory.jsand the
ngfactory.d.tsalexeagle commentedon Jun 14, 2018
We figure that Bazel angular usage has never worked with components that come from third-party libraries in node_modules.
We are writing deep imports in the user factory files, like
@angular/router/router.ngfactory, and these deep imports don't work with bazel resolution strategy.We are in a mixed mode, where we generate commonjs/es5 ngfactory.js files which Rollup won't know how to resolve.
We could probably find some fix for this, but this doesn't look the same as either google3 or current external, so we are adding complexity. Maybe it is better to fix this by moving all the way to Bazel compilation of libraries from source.
alexeagle commentedon Jun 14, 2018
Another possibility to fix the regression in the short-term by moving this component to some other NgModule in the router package so that user code doesn't generate such an import unless they've opted in.
alexeagle commentedon Jun 14, 2018
@gregmagolan will take a look at making Angular source dependency work in angular-bazel-example, which would give us a principled way to avoid these issues.
gregmagolan commentedon Jun 26, 2018
@alexeagle angular-bazel-example with angular build from source is working with the latest router here: bazel-contrib/rules_nodejs#240. Looks promising. This would resole this issue since the build no longer uses mixed mode (bazel & ngc) for angular. Although in the example, mixed mode is still needed for
@ngrx.mhevery commentedon Jun 28, 2018
@gregmagolan does that mean we can close this issue?
gregmagolan commentedon Jun 28, 2018
@mhevery Seems like the best way to go to build angular from source. Resolves this issue as well as bazelbuild/rules_typescript#192. Once all the related PRs land then this can get closed. Lets leave it open for now.
mlc-mlapis commentedon Jul 4, 2018
@alxhub @alexeagle @gregmagolan ... using Angular "6.1.0-beta.3" and pure
ngccompilation produces the following line likevar i3 = require("../../node_modules/@angular/router/router.ngfactory");(in this example in our factory fileapp.module.ngfactory.js).The next bundling step (SystemJS or Rollup, ...) for our app creates a not resolvable dependency in the final code.
The last correct version of Angular was
6.0.4and since that time all others have been producing the problem and doesn't allow us to use them ... a real hard break change.I suppose that this problem is related how Angular packages are built using Bazel but still don't understand what the comment above means (which / why
@Component):and mainly what is the solution to allow correct compilation of an app using ngc. Can you give us some more explanation?
johnbendi commentedon Jul 9, 2018
@mlc-mlapis what @alexeagle means by
@Component...is that the@angular/routerpackage didn't previously include that in versions on or prior to6.0.4but now it's inclusion is making your build to fail.mlc-mlapis commentedon Jul 9, 2018
@johnbendi ... yep, thanks, you mean the following code in
angular/packages/router/src/components/empty_outlet.ts?Hmm, hard to guess why this is necessary since 6.0.5 and not before.
alexeagle commentedon Jul 11, 2018
EmptyOutletComponentwas introduced to fix some other issue - it just so happens no Angular package ever had a Component before. So Bazel users are still stuck on Angular 6.0.4 for now.Update on this issue: Greg has all the moving parts to switch to a source dependency on Angular, like we do internally at Google, but it's taking some time to land this work.
mlc-mlapis commentedon Jul 12, 2018
@alexeagle ... thanks for the update. Do you think that it is realistic to count with that landing even in 6.1.0 version? It also blocks building paths when using Rollup, SystemJS, ... so no way forward.
alexeagle commentedon Jul 17, 2018
No, 6.1.0 is in RC and will release this week or next (?) so I don't think this will make it.
I suppose we should reconsider rolling back the EmptyOutletComponent, or somehow excluding that from Bazel builds. @jasonaden any ideas?
jelbourn commentedon Jul 18, 2018
It looks like this would also prevent Angular Material from using Angular 6.1 (and thus TypeScript 2.9), since it would break what Bazel stuff we do have working.
gregmagolan commentedon Jul 31, 2018
Example of building angular from source to resolve this issue is here: angular/angular-bazel-example#160
That still depends on landing bazelbuild/rules_typescript#223 in rules_typescript which includes a work-around which either needs to be finalized or a principled fix in angular/angular put together
danwulff commentedon Aug 9, 2018
It's very frustrating that Angular projects that utilize Material are unable to use TS 2.9 because of this. Do we have an ETA on when this will get fixed? @alxhub
gregmagolan commentedon Aug 10, 2018
Latest angular can now be build with bazel with angular being built from source. angular/angular-bazel-example#160 was merged in and https://github.com/alexeagle/angular-bazel-example is now building Angular 6.1.2.
@danwulff: @jelbourn is working on updating Angular Material as well.
mlc-mlapis commentedon Aug 10, 2018
@gregmagolan ... I tested Angular 6.1.2 and the problem still persists. Simply using
ngcthere is generated the line likevar i3 = require("../../node_modules/@angular/router/router.ngfactory");in each module (in its .module.ngfactory.js) which imports@angular/routermodule. 😢gregmagolan commentedon Aug 10, 2018
@mlc-mlapis You'll need to make some changes to your Bazel build configuration with Angular 6.1.2. This guide should help https://github.com/alexeagle/angular-bazel-example/wiki/Upgrading-Angular-Bazel-build-to-Angular-6.2.1. Feel free to post issues to https://github.com/alexeagle/angular-bazel-example if you run into other issues.
mlc-mlapis commentedon Aug 10, 2018
@gregmagolan ... not sure if we understand each other but we are using just pure
ngccompiler for project AOT compilation, nothing else (sure on the base of installed NPM @angular packages). So no direct Bazel configuration or so ...gregmagolan commentedon Aug 11, 2018
@mlc-mlapis Oh I see. That would be a different issue from this one. This issue is specific to building Angular with Bazel. Please file a new issue.
mlc-mlapis commentedon Aug 11, 2018
@gregmagolan ... Ok, I'll file it. But I think that the main origin of the problem is the same ... the existence of the new code:
in Router package.
mlc-mlapis commentedon Aug 11, 2018
@gregmagolan ... I checked the case once more and we finally found out a way how to configure our build path to accept
@Componentused even inside Angular packages (because in such cases .ngfactory.js files are produced byngccompiler). So I won't file a new issue at all.angular-automatic-lock-bot commentedon Sep 13, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.