-
Notifications
You must be signed in to change notification settings - Fork 399
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
Support for "build" option for TypeScript project references? #392
Comments
I'm not sure whether it makes sense to use TS project references in combination with Nest CLI. Can you share a sample repository? |
Hi! Thanks for the reply. Sure, here is an example: https://github.com/gremo/nestangular-boilerplate As you can see in Why I'm using TypeScript project references? That's simple. That is a Yarn workspace project here directory With Yarn workspaces and TS project references I can manage dependencies and output "structure" very easily. |
Thanks! There are no docs for TypeScript Compiler API with Project references so far. I'd recommend sticking with the existing configuration for now. |
What do you mean with "existing configuration for now"? |
With |
In the latest version of the CLI (^6.10.x), we support project references partially, similarly to this issue: TypeStrong/ts-loader#851 (comment) Copy & pasted from Using project references currently requires building referenced projects outside of Nest CLI. Nest CLI has partial support for project references in that it will load dependent composite projects that are already built, but will not currently build/rebuild those upstream projects. The best way to explain exactly what this means is through an example. Say you have a project with a project reference pointing to the
And we’ll assume that the root
Using project references actually instructs TEMPORARY SOLUTIONFirst, run |
@kamilmysliwiec thank you a lot. I don't like to build with |
Are there any changes on this? |
- Nest doesn't support composite in TypeScript (Project References) nestjs/nest-cli#392 - Moved providers + tests under 'api' project - Moved Cheerio library dependency (for scraping) under 'api' project - Duplicated schema (typings) in both 'api' and 'app' projects
Just wrote a workaround on this problem for you guys on Yarn Workspaces:
const typescript = require('typescript')
const { exec } = require('child_process')
const tsconfig = typescript.readConfigFile('tsconfig.json', typescript.sys.readFile)
const references = tsconfig.config.references;
references.forEach(({ path }) => {
exec(`tsc --project ${path}`, () => {
console.log(`BUILT REFERENCE: ${path}`);
})
});
{
"references:build": "node buildReferences.js",
"prebuild": "yarn references:build",
"predev": "yarn references:build"
} Might not be the fastest option out there, but I think is better than running "tsc" twice every time. |
Are there any changes on this? I would still love to see the |
@kamilmysliwiec the above recommendation does not work on For example:
The above setup will build fine with:
OR
BUT will fail with
|
Hello @kamilmysliwiec. Do you have any updates about it? |
Is there any update on this? This would be a very useful feature for me and my company |
I've worked around this in some of my projects by modifying the (An additional point on getting the |
Hi, I've checked the repository and there is one commit with maybe add support for TS project references - cd2d0af @kamilmysliwiec do you have an example of how it works, please? I've tried to print the content of
projectReferences but it was undefined. Is the projectReference related to TS project reference? My tsconfig.json with a reference is:
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": true,
"noImplicitAny": true,
"strictBindCallApply": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true
},
"references": [
{
"path": "./../packages/common"
}
]
} |
Hi, is this thread alive? 😉 It would be a super helpful feature, as working in a huge monorepo environments without typescript |
Hi, I'm also interested in supporting typescript |
This would be really helpful if |
Also interested in this. I don't care about using |
FWIW, for those interested in another solution, I am able to get this working with |
Also interested in this... We are working in a mono repo with different projects and want to share a package between them using |
I want to develop a plug-in architecture and need to use it |
Does the CLi support the build flag (
-b
fortsc
)? It seems not.... I'm trying to setup a project with TypeScript project references... any help?The text was updated successfully, but these errors were encountered: