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

codegen:generate Global typings error in Angular workspace #1310

Open
klemenoslaj opened this issue May 31, 2019 · 0 comments
Open

codegen:generate Global typings error in Angular workspace #1310

klemenoslaj opened this issue May 31, 2019 · 0 comments
Labels
🤖 component - codegen related to the codegen core packages

Comments

@klemenoslaj
Copy link

klemenoslaj commented May 31, 2019

Intended outcome:

With Angular we can end up with multiple interconnected projects in one workspace. What I would expect is, that even if libraries depend on one another, autogenerated code would not break once built in the dist and consumed by the application.

Actual outcome:

When we build the libraries, there is no error, however once we try to consume them with application, the error appears, because the paths in autogenerated code are obviously wrong, since they relatively point to root __generated__ folder from their source origin, while currently located in the dist folder.

How to reproduce the issue:

  • Clone the following repo: https://github.com/klemenoslaj/apollo-codegen-globaltypings-problem
  • Install dependencies
  • Execute yarn codegen (apollo codegen:generate)
  • Execute yarn ng build library (builds library1)
  • Execute yarn ng serve(serves the application)
  • Following error appears: ERROR in dist/library1/lib/__generated__/ExampleFragment.d.ts(1,29): error TS2307: Cannot find module './../../../../../__generated__/globalTypes.d'.

Question: Maybe importing the file with a path relative to the project root instead would do the trick?

Versions

apollo/2.12.5 darwin-x64 node-v10.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 component - codegen related to the codegen core packages
Projects
None yet
Development

No branches or pull requests

2 participants