Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI Monorepo fails to build #33659

Closed
gnomeontherun opened this issue Nov 7, 2019 · 1 comment
Closed

CLI Monorepo fails to build #33659

gnomeontherun opened this issue Nov 7, 2019 · 1 comment

Comments

@gnomeontherun
Copy link
Contributor

@gnomeontherun gnomeontherun commented Nov 7, 2019

馃悶 bug report

Affected Package

The issue is caused by package @angular/compiler-cli or @angular/cli

Is this a regression?

Yes, it used to build before Ivy.

Description

Creating a new CLI project in a monorepo style, adding an application and a library, cannot build the application. It throws the same error as in #29361. It seems something about the configuration is wrong as generated by the CLI, though our project follows the same patterns and has the same errors (https://github.com/gnomeontherun/clarity/tree/angular9).

I opened a previous issue #33482 which is the same problem, but it was closed. @alxhub provided a fix, but testing his repository throws a different error so it really isn't fixed or working as far as I can tell.

Alex also has a draft of notes about some build notes here https://hackmd.io/zhu28RUcRiaG0DZq5bLy1A?view.

馃敩 Minimal Reproduction

I made a CircleCI job that runs a few CLI commands to generate a project, manually add the library to the application, then try to build.

https://github.com/gnomeontherun/monorepo-library-errors

It has an artifact you can download with the result of the build: https://19-219057101-gh.circle-artifacts.com/0/home/circleci/project/artifact.tar

馃敟 Exception or Error


ERROR in Unable to write a reference to SharedComponent in /home/circleci/project/monorepo/projects/shared/src/lib/shared.component.ts from /home/circleci/project/monorepo/projects/shared/src/lib/shared.module.ts

馃實 Your Environment

The job loads the current @next tags.

Angular Version:


Angular CLI: 9.0.0-rc.0
Node: 10.16.0
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.0-rc.0
@angular-devkit/core         9.0.0-rc.0
@angular-devkit/schematics   9.0.0-rc.0
@schematics/angular          9.0.0-rc.0
@schematics/update           0.900.0-rc.0
rxjs                         6.5.3

Anything else relevant?

@atscott atscott added the comp: ngcc label Nov 7, 2019
@ngbot ngbot bot added this to the needsTriage milestone Nov 7, 2019
@alxhub alxhub added this to Backlog in Compiler via automation Nov 7, 2019
@alxhub alxhub self-assigned this Nov 7, 2019
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Nov 7, 2019
@lucienbertin lucienbertin mentioned this issue Nov 8, 2019
0 of 4 tasks complete
@kuncevic

This comment has been minimized.

Copy link
Contributor

@kuncevic kuncevic commented Nov 10, 2019

Was being recently playing with 9 but got that error馃憞馃徎:
ERROR in Unable to write a reference to SharedLibComponent in /Users/A/Work/Projects/tmp/angular9-multi-app/projects/shared-lib/src/lib/shared-lib.component.ts from /Users/A/Work/Projects/tmp/angular9-multi-app/projects/shared-lib/src/lib/shared-lib.module.ts

here is my repo that reproduce the error https://github.com/kuncevic/angular9-multi-app

alxhub added a commit to alxhub/angular that referenced this issue Nov 15, 2019
Previously, the compiler assumed that all TS files logically within a
project existed under one or more "root directories". If the TS compiler
option `rootDir` or `rootDirs` was set, they would dictate the root
directories in use, otherwise the current directory was used.

Unfortunately this assumption was unfounded - it's common for projects
without explicit `rootDirs` to import from files outside the current
working directory. In such cases the `LogicalProjectStrategy` would attempt
to generate imports into those files, and fail. This would lead to no
`ReferenceEmitStrategy` being able to generate an import, and end in a
compiler assertion failure.

This commit introduces a new strategy to use when there are no `rootDirs`
explicitly present, the `RelativePathStrategy`. It uses simpler, filesystem-
relative paths to generate imports, even to files above the current working
directory.

Fixes angular#33659
Fixes angular#33562
gkalpak added a commit to gkalpak/angular that referenced this issue Nov 18, 2019
Previously, the compiler assumed that all TS files logically within a
project existed under one or more "root directories". If the TS compiler
option `rootDir` or `rootDirs` was set, they would dictate the root
directories in use, otherwise the current directory was used.

Unfortunately this assumption was unfounded - it's common for projects
without explicit `rootDirs` to import from files outside the current
working directory. In such cases the `LogicalProjectStrategy` would attempt
to generate imports into those files, and fail. This would lead to no
`ReferenceEmitStrategy` being able to generate an import, and end in a
compiler assertion failure.

This commit introduces a new strategy to use when there are no `rootDirs`
explicitly present, the `RelativePathStrategy`. It uses simpler, filesystem-
relative paths to generate imports, even to files above the current working
directory.

Fixes angular#33659
Fixes angular#33562
alxhub added a commit to alxhub/angular that referenced this issue Nov 18, 2019
Previously, the compiler assumed that all TS files logically within a
project existed under one or more "root directories". If the TS compiler
option `rootDir` or `rootDirs` was set, they would dictate the root
directories in use, otherwise the current directory was used.

Unfortunately this assumption was unfounded - it's common for projects
without explicit `rootDirs` to import from files outside the current
working directory. In such cases the `LogicalProjectStrategy` would attempt
to generate imports into those files, and fail. This would lead to no
`ReferenceEmitStrategy` being able to generate an import, and end in a
compiler assertion failure.

This commit introduces a new strategy to use when there are no `rootDirs`
explicitly present, the `RelativePathStrategy`. It uses simpler, filesystem-
relative paths to generate imports, even to files above the current working
directory.

Fixes angular#33659
Fixes angular#33562
gkalpak added a commit to gkalpak/angular that referenced this issue Nov 19, 2019
Previously, the compiler assumed that all TS files logically within a
project existed under one or more "root directories". If the TS compiler
option `rootDir` or `rootDirs` was set, they would dictate the root
directories in use, otherwise the current directory was used.

Unfortunately this assumption was unfounded - it's common for projects
without explicit `rootDirs` to import from files outside the current
working directory. In such cases the `LogicalProjectStrategy` would attempt
to generate imports into those files, and fail. This would lead to no
`ReferenceEmitStrategy` being able to generate an import, and end in a
compiler assertion failure.

This commit introduces a new strategy to use when there are no `rootDirs`
explicitly present, the `RelativePathStrategy`. It uses simpler, filesystem-
relative paths to generate imports, even to files above the current working
directory.

Fixes angular#33659
Fixes angular#33562
@alxhub alxhub closed this in 850aee2 Nov 19, 2019
alxhub added a commit that referenced this issue Nov 19, 2019
鈥3828)

Previously, the compiler assumed that all TS files logically within a
project existed under one or more "root directories". If the TS compiler
option `rootDir` or `rootDirs` was set, they would dictate the root
directories in use, otherwise the current directory was used.

Unfortunately this assumption was unfounded - it's common for projects
without explicit `rootDirs` to import from files outside the current
working directory. In such cases the `LogicalProjectStrategy` would attempt
to generate imports into those files, and fail. This would lead to no
`ReferenceEmitStrategy` being able to generate an import, and end in a
compiler assertion failure.

This commit introduces a new strategy to use when there are no `rootDirs`
explicitly present, the `RelativePathStrategy`. It uses simpler, filesystem-
relative paths to generate imports, even to files above the current working
directory.

Fixes #33659
Fixes #33562

PR Close #33828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Compiler
Backlog
4 participants
You can鈥檛 perform that action at this time.