Skip to content

Compilation issues when using Angular Material 5.0.x/5.1.0 in an Angular/Bazel app #9502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pshields opened this issue Jan 20, 2018 · 12 comments
Assignees
Labels
P2 The issue is important to a large percentage of users, with a workaround

Comments

@pshields
Copy link

Angular Material 5.1.0 (and 5.0.x) currently encounters compilation errors when consumed from an Angular/Bazel app.

An example error is Could not resolve ./index.ngfactory from [....]/angular_bazel_example/node_modules/@angular/material/button/typings/index.d.ts.

To reproduce, run bazel build //src from angular/angular-bazel-example#63 (small repro PR.)

I've confirmed that node_modules/@angular/material/button/typings/index.ngfactory.js is present, so I'm not sure why the import can't be resolved. The error is occurring in TsCompilerAotCompilerTypeCheckHostAdapter.fromSummaryFileName, which is defined in https://github.com/angular/angular/blob/5.2.x/packages/compiler-cli/src/transformers/compiler_host.ts. One guess I had is that the summary loader may be looking for a .ts file instead of a .js file, but I couldn't tell from looking at that file whether or not that is the case.

/cc @alexeagle @jelbourn

@jelbourn jelbourn self-assigned this Jan 22, 2018
@jelbourn jelbourn added the P2 The issue is important to a large percentage of users, with a workaround label Jan 22, 2018
@jelbourn
Copy link
Member

@alexeagle we probably need to do something extra to make our packages bazel-friendly. It probably makes the most sense to wait until the ng_package rule is ready and just use that.

@adamyi
Copy link

adamyi commented Jan 29, 2018

It appears that index.ngfactory.js is not present in Bazel's sandbox dir in my case.

$ ls -lah /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/bazel-sandbox/5702975849333547229/execroot/mpstar/node_modules/@angular/material/button/typings/
total 72
drwxr-xr-x  11 adamyi  wheel   374B Jan 29 22:04 .
drwxr-xr-x   7 adamyi  wheel   238B Jan 29 22:04 ..
lrwxr-xr-x   1 adamyi  wheel   144B Jan 29 22:04 button-module.d.ts -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/button-module.d.ts
lrwxr-xr-x   1 adamyi  wheel   154B Jan 29 22:04 button-module.ngsummary.json -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/button-module.ngsummary.json
lrwxr-xr-x   1 adamyi  wheel   137B Jan 29 22:04 button.d.ts -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/button.d.ts
lrwxr-xr-x   1 adamyi  wheel   147B Jan 29 22:04 button.ngsummary.json -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/button.ngsummary.json
lrwxr-xr-x   1 adamyi  wheel   136B Jan 29 22:04 index.d.ts -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/index.d.ts
lrwxr-xr-x   1 adamyi  wheel   145B Jan 29 22:04 index.metadata.json -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/index.metadata.json
lrwxr-xr-x   1 adamyi  wheel   146B Jan 29 22:04 index.ngsummary.json -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/index.ngsummary.json
lrwxr-xr-x   1 adamyi  wheel   141B Jan 29 22:04 public-api.d.ts -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/public-api.d.ts
lrwxr-xr-x   1 adamyi  wheel   151B Jan 29 22:04 public-api.ngsummary.json -> /private/var/tmp/_bazel_adamyi/c6ce702e3f48b85fcb41d85f1378ee2d/execroot/mpstar/node_modules/@angular/material/button/typings/public-api.ngsummary.json

$ ls -lah node_modules/@angular/material/button/typings/
total 240
drwxr-xr-x  13 adamyi  staff   442B Jan 29 22:04 .
drwxr-xr-x   7 adamyi  staff   238B Jan 29 21:54 ..
-rw-r--r--   1 adamyi  staff    41B Jan 18 08:38 button-module.d.ts
-rw-r--r--   1 adamyi  staff   187B Jan 29 21:54 button-module.ngsummary.json
-rw-r--r--   1 adamyi  staff   2.6K Jan 18 08:38 button.d.ts
-rw-r--r--   1 adamyi  staff   3.3K Jan 29 21:54 button.ngsummary.json
-rw-r--r--   1 adamyi  staff    78B Jan 18 08:38 index.d.ts
-rw-r--r--   1 adamyi  staff    18K Jan 18 08:38 index.metadata.json
-rw-r--r--   1 adamyi  staff    15K Jan 29 21:54 index.ngfactory.js
-rw-r--r--   1 adamyi  staff    25K Jan 29 22:04 index.ngsummary.json
-rw-r--r--   1 adamyi  staff   261B Jan 18 08:38 public-api.d.ts
-rw-r--r--   1 adamyi  staff   2.1K Jan 29 21:54 public-api.ngsummary.json

@adamyi
Copy link

adamyi commented Jan 29, 2018

https://github.com/angular/angular/blob/master/packages/bazel/src/ng_module.bzl#L195

This is fixed if I add *.ngfactory.js there (also in node_modules rule in Bazel file). However I don't know if this is the correct way to do this. If this is ok, I can send a PR there.

@adamyi
Copy link

adamyi commented Jan 29, 2018

In the bazel app, this has the same problem as angular/angular-bazel-example#56 for the devserver (but rollup and closure are fine). I think it's better to just use Bazel dependency to build material2.

@mattem
Copy link

mattem commented Feb 23, 2018

I know this is a work in progress, but is there an update to this issue or anything that I could do to help out (or work around)?
This is the issue I am hitting while experimenting with Bazel building our application.

@jelbourn
Copy link
Member

We're still in the process of making out own build setup use bazel. There are unfortunately still a lot of issues to iron out.

@yamxun
Copy link

yamxun commented Mar 12, 2018

Any updates on this with https://github.com/alexeagle/angular-bazel-example/wiki/Publishing-Libraries in place? Material is one crucial thing blocking my team to switch to Bazel.

@jelbourn
Copy link
Member

We're still working on the bazel support overall

@alexeagle
Copy link
Contributor

@yamxun I think Angular v6 is a likely timeframe for this to land (early April) but we can't promise anything. Of course Angular material is one of the first libraries we'll expect to have working.

@ewhauser
Copy link

ewhauser commented Jul 4, 2018

Any update on this issue? This problem still exists in Angular 6.0.4.

@yamxun
Copy link

yamxun commented Sep 25, 2018

Any updates on this?

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

No branches or pull requests

8 participants