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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression(compiler-cli): different code output between ngc and tsc v5 #19339

Closed
Toxicable opened this issue Sep 22, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@Toxicable
Copy link
Contributor

commented Sep 22, 2017

I'm submitting a...

[x] Regression

v5.0.0-beta.7
Minimal Repo: https://github.com/Toxicable/ngc-outputchange
Instructions: https://github.com/Toxicable/ngc-outputchange/blob/master/modules/module-name/index.ts

This has caused a regression for how we use ngc over on angular/universal see: angular/universal#805 (partially out fault since we don't have testing)

When you have nested submodules that have their own tsconfig's and you run ngc it will output node_modules(just metadata) along with the full directory path, rather than just the sub module

Input:
/modules/module-name/index.ts
/modules/module-name/tsconfig

Output:
ngc:/dist/module-name/modules/module-name/index.js
tsc: /dist/module-name/index.js

@vikerman

This comment has been minimized.

Copy link
Contributor

commented Sep 22, 2017

Could work around it in angular/universal by setting "skipTemplateCodegen": true in "angularCompilerOptions" in tsconfig.json. But this is a regression in ngc that should be fixed.

vikerman added a commit to angular/universal that referenced this issue Sep 22, 2017

fix(build): fix dist/ output structure and packaging
Casued by regression in ngc - angular/angular#19339.

Worked around by adding "skipTemplateCodegen": "true" (but that is anyway needed).

@chuckjaz chuckjaz self-assigned this Sep 27, 2017

@chuckjaz

This comment has been minimized.

Copy link
Member

commented Sep 27, 2017

This is a side-effect of our now ignoring "genDir".

We should consider paying attention to "genDir" to avoid breaking builds that used "genDir" instead of "skipTemplateCodegen" to work around this issue.

Details

The reason the location moves is because TypeScript infers the base directory from the common root directory of all files included in the project. Without "genDir" the factory files are produced in the corresponding directory in node_modules. This makes the inferred baseDir to be the project root directory instead of the directory containing the tsconfig.json file.

Supplying "genDir" in 4.0 caused the files to be generated as a subdirectory of the directory containing the tsconfig.json file avoiding this issue.

Supplying "skipTemplateCodegen" in both 4.0 and 5.0 avoids this issue because the factory files are not generated and are not added to the project avoiding this issue.

@tbosch

This comment has been minimized.

Copy link
Member

commented Oct 3, 2017

Closing as works as intended, but we need to document this different behavior.

@tbosch tbosch closed this Oct 3, 2017

@buren buren referenced this issue Nov 11, 2017

Merged

Angular v5 #555

@vforv

This comment has been minimized.

Copy link

commented Nov 18, 2017

Not working for me....

src/main.client-closure.ts(2,42): error TS2307: Cannot find module '../built/src/app/app.client.module.ngfactory'.

Compiler not generading files...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.