IVY doesn't working on Windows even in Angular 8.0.0-beta.7
See original GitHub issue🐞 bug report
Affected Package
Angular IVY on Windows
Description
I know there was a file path problem in Angular IVY compiler on Windows, but it seems that it has been fixed in Angular 8.0.0-beta.7 (https://github.com/angular/angular/pull/28752)
I tried compiling my project with latest version of Angular. ivy-ngcc postinstall script in package.json seem to be working fine. But it still doesn’t recognizing the modules of the app and showing below error:
ERROR in Unable to write a reference to MyDirective in D:/MyProject/src/app/shared/my-directive/my-directive.directive.ts from D:/MyProject/src/app/shared/my-directive/my-directive.module.ts
I am following the instructions mentioned in https://next.angular.io/guide/ivy
I thought I could be missing something while updating my existing project.
So I tried generating a new project using below command:
ng new temp --enableIvy
After generating the project I updated Angular to latest version Angular 8.0.0-beta.7.
When running npm install, I can see that after package installation ivy-ngcc postinstall script in package.json seem to be working fine.
But when I tried running the build command ng build --prod
, it threw below error:
ERROR in Unable to write a reference to AppComponent in D:/MyProject/src/app/app.component.ts from D:/MyProject/src/app/app.module.ts
🔬 Minimal Reproduction
On windows machine generate a new project:
ng new temp --enableIvy
Update Angular to latest version i.e. Angular 8.0.0-beta.7
Run npm install
Then run ng build --prod
🔥 Exception or Error
```
ERROR in Unable to write a reference to AppComponent in D:/MyProject/src/app/app.component.ts from D:/MyProject/src/app/app.module.ts
```
🌍 Your Environment
Angular Version:
Angular CLI: 8.0.0-beta.4
Node: 8.11.4
OS: win32 x64
Angular: 8.0.0-beta.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.14.0-beta.4
@angular-devkit/build-angular 0.14.0-beta.4
@angular-devkit/build-optimizer 0.14.0-beta.4
@angular-devkit/build-webpack 0.14.0-beta.4
@angular-devkit/core 8.0.0-beta.4
@angular-devkit/schematics 8.0.0-beta.4
@angular/cli 8.0.0-beta.4
@ngtools/webpack 8.0.0-beta.4
@schematics/angular 8.0.0-beta.4
@schematics/update 0.14.0-beta.4
rxjs 6.4.0
typescript 3.2.4
webpack 4.29.5
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
rootDirs
that come to the LogicalFileSystem have absolute paths with leading slash, i.e.['/D/Angular/ivy-test/...']
where D is a name of driver.due to the fact how Angular cli normalizes such paths https://github.com/angular/angular-cli/blob/fd5cb7a7f0c36e737fb3bb5e64fb2b66c2fef55d/packages/angular_devkit/core/src/virtual-fs/path.ts#L210
Because of that Windows version is broken here
https://github.com/angular/angular/blob/7060d9038b11a7c67cdce6b58464a935e9a340c5/packages/compiler-cli/src/ngtsc/path/src/logical.ts#L79-L83
@alxhub please take a look
Hi @alexzuza, that is indeed part of the problem, however another problem is that if you don’t use the CLI the problem still persists because
getCurrentDirectory
https://github.com/angular/angular/blob/master/packages/compiler-cli/src/ngtsc/util/src/typescript.ts#L79 is assumed to be posix separated which is not when using typescript compiler directly.Will be landing a couple of PRs to fix these implementations soon.