You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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:
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 acreateProgram
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.
The text was updated successfully, but these errors were encountered: