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

Compiler API, working with project references #30249

Closed
duro opened this issue Mar 7, 2019 · 1 comment
Closed

Compiler API, working with project references #30249

duro opened this issue Mar 7, 2019 · 1 comment

Comments

@duro
Copy link

duro commented Mar 7, 2019

I am working on a plugin for the serverless framework which will compile typescript projects which use project references. This requires me to programmatically execute the compiler in code.

I have been piecing things together using the Compiler API Wiki and a few other example projects, but none of these seem to take into account project references.

The problem I run into is that the referenced projects are not built prior to the main project, and so I get errors from the compiler like:

/Users/adamduro/Workspace/projects/freebird/serverless-test/services/user/src/handler.ts (2,28): Cannot find module '@freebird/response-output'.

I was able to gather from inspecting the src/tsc/tsc.ts file from the main TypeScript repo that there is a way to pass in the project references to a createProgram function, but this did not seem to be enough.

Here is an example of most of my programatic compile API code:

https://github.com/FreebirdRides/serverless-mono-test/blob/master/packages/serverless-plugin-typescript/lib/typescript.js

And the code in that file is executed here:

https://github.com/FreebirdRides/serverless-mono-test/blob/master/packages/serverless-plugin-typescript/lib/index.js

At the end of the day I'm just trying to replicate the functionality that running tsc -b . would produce when ran in this folder:

https://github.com/FreebirdRides/serverless-mono-test/tree/master/services/user

Any guidance anyone can provide? The compile API is a bit under documented now, and there is no mention of the project references anywhere.

@duro
Copy link
Author

duro commented Mar 7, 2019

Seems this issue (#28640) answers my question. Can't be done yet.

@duro duro closed this as completed Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant