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

Failed to compile entry-point @angular/platform-browser due to compilation errors #34411

Closed
splincode opened this issue Dec 14, 2019 · 2 comments
Closed
Labels
Milestone

Comments

@splincode
Copy link
Contributor

@splincode splincode commented Dec 14, 2019

馃悶 bug report

Affected Package

The issue is caused by NGCC

image

Description

If use ngcc --async false then no problem

Related: #34191, #34254

馃敩 Minimal Reproduction

$ git clone https://github.com/ngxs/store
$ yarn install
$ cd integrations/ivy
$ npx ngcc

馃實 Your Environment

Angular Version:

Angular 9-rc.6

@JoostK

This comment has been minimized.

Copy link
Member

@JoostK JoostK commented Dec 15, 2019

Thanks for reporting, @splincode!

I have found the cause of this issue, it is indeed due to parallelization. It's because there's a filesystem cache involved that does not see file writes from other workers.

EDIT: The actual root cause of this issue is that there's a type-only import in @ngxs/store/operators into @ngxs/store, which is only present in the .d.ts files. Because of this, ngcc does not determine @ngxs/store as a dependency, as it determines dependencies from the source files, not the typing files. Consequently, @ngxs/store/operators is processed before @ngxs/store is processed, and more importantly is it processed before the transitive dep on @angular/core is processed, while still consuming the .d.ts files of @angular/core because it's a transitive dep. As such, the file system cache has been primed with .d.ts files of @angular/core before it has been processed, so updates to these declarations in another worker will not be taken into account as the stale cache entry is not evicted.

@petebacondarwin

This comment has been minimized.

Copy link
Member

@petebacondarwin petebacondarwin commented Dec 19, 2019

Should be fixed by #34494

petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 19, 2019
鈥urce

ngcc computes a dependency graph of entry-points to ensure that
entry-points are processed in the correct order. Previously only the imports
in source files were analysed to determine the dependencies for each
entry-point.

This is not sufficient when an entry-point has a "type-only" dependency
 - for example only importing an interface from another entry-point.
In this case the "type-only" import does not appear in the
source code. It only appears in the typings files. This can cause a
dependency to be missed on the entry-point.

This commit fixes this by additionally processing the imports in the
typings program, as well as the source program.

Note that these missing dependencies could cause unexpected flakes when
running ngcc in async mode on multiple processes due to the way that
ngcc caches files when they are first read from disk.

Fixes angular#34411

// FW-1781
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 20, 2019
鈥urce

ngcc computes a dependency graph of entry-points to ensure that
entry-points are processed in the correct order. Previously only the imports
in source files were analysed to determine the dependencies for each
entry-point.

This is not sufficient when an entry-point has a "type-only" dependency
 - for example only importing an interface from another entry-point.
In this case the "type-only" import does not appear in the
source code. It only appears in the typings files. This can cause a
dependency to be missed on the entry-point.

This commit fixes this by additionally processing the imports in the
typings program, as well as the source program.

Note that these missing dependencies could cause unexpected flakes when
running ngcc in async mode on multiple processes due to the way that
ngcc caches files when they are first read from disk.

Fixes angular#34411

// FW-1781
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 23, 2019
鈥urce

ngcc computes a dependency graph of entry-points to ensure that
entry-points are processed in the correct order. Previously only the imports
in source files were analysed to determine the dependencies for each
entry-point.

This is not sufficient when an entry-point has a "type-only" dependency
 - for example only importing an interface from another entry-point.
In this case the "type-only" import does not appear in the
source code. It only appears in the typings files. This can cause a
dependency to be missed on the entry-point.

This commit fixes this by additionally processing the imports in the
typings program, as well as the source program.

Note that these missing dependencies could cause unexpected flakes when
running ngcc in async mode on multiple processes due to the way that
ngcc caches files when they are first read from disk.

Fixes angular#34411

// FW-1781
petebacondarwin added a commit to petebacondarwin/angular that referenced this issue Dec 23, 2019
鈥urce

ngcc computes a dependency graph of entry-points to ensure that
entry-points are processed in the correct order. Previously only the imports
in source files were analysed to determine the dependencies for each
entry-point.

This is not sufficient when an entry-point has a "type-only" dependency
 - for example only importing an interface from another entry-point.
In this case the "type-only" import does not appear in the
source code. It only appears in the typings files. This can cause a
dependency to be missed on the entry-point.

This commit fixes this by additionally processing the imports in the
typings program, as well as the source program.

Note that these missing dependencies could cause unexpected flakes when
running ngcc in async mode on multiple processes due to the way that
ngcc caches files when they are first read from disk.

Fixes angular#34411

// FW-1781
alxhub added a commit that referenced this issue Jan 7, 2020
鈥urce (#34494)

ngcc computes a dependency graph of entry-points to ensure that
entry-points are processed in the correct order. Previously only the imports
in source files were analysed to determine the dependencies for each
entry-point.

This is not sufficient when an entry-point has a "type-only" dependency
 - for example only importing an interface from another entry-point.
In this case the "type-only" import does not appear in the
source code. It only appears in the typings files. This can cause a
dependency to be missed on the entry-point.

This commit fixes this by additionally processing the imports in the
typings program, as well as the source program.

Note that these missing dependencies could cause unexpected flakes when
running ngcc in async mode on multiple processes due to the way that
ngcc caches files when they are first read from disk.

Fixes #34411

// FW-1781

PR Close #34494
@alxhub alxhub closed this in 4f42de9 Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can鈥檛 perform that action at this time.