Assets only works on top level project.
mkabatek opened this issue · 1 comments
mkabatek commented
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
If I have a nest-cli.json like like below I can use the assets
to get files from top level project. However If I want to store my assets along with a library it doesn't properly copy the assets/
"collection": "@nestjs/schematics",
"sourceRoot": "apps/api/src",
"monorepo": true,
"root": "apps/api",
"compilerOptions": {
"webpack": true,
"tsConfigPath": "apps/api/tsconfig.app.json",
"assets": [{ "include": "**/*.html", "outDir": "dist/apps", "watchAssets": true }]
},
"projects": {
"api": {
"type": "application",
"root": "apps/api",
"entryFile": "main",
"sourceRoot": "apps/api/src",
"compilerOptions": {
"tsConfigPath": "apps/api/tsconfig.app.json"
}
},
"jobs": {
"type": "application",
"root": "apps/jobs",
"entryFile": "main",
"sourceRoot": "apps/jobs/src",
"compilerOptions": {
"tsConfigPath": "apps/jobs/tsconfig.app.json"
}
},
"persistence": {
"type": "library",
"root": "libs/persistence",
"entryFile": "index",
"sourceRoot": "libs/persistence/src",
"compilerOptions": {
"tsConfigPath": "libs/persistence/tsconfig.lib.json"
}
},
....
For example if I wanted to do this below, and put my assets with a library, the assets don't copy into the build directory.
"collection": "@nestjs/schematics",
"sourceRoot": "apps/api/src",
"monorepo": true,
"root": "apps/api",
"compilerOptions": {
"webpack": true,
"tsConfigPath": "apps/api/tsconfig.app.json"
},
"projects": {
"api": {
"type": "application",
"root": "apps/api",
"entryFile": "main",
"sourceRoot": "apps/api/src",
"compilerOptions": {
"tsConfigPath": "apps/api/tsconfig.app.json"
}
},
"jobs": {
"type": "application",
"root": "apps/jobs",
"entryFile": "main",
"sourceRoot": "apps/jobs/src",
"compilerOptions": {
"tsConfigPath": "apps/jobs/tsconfig.app.json"
}
},
"persistence": {
"type": "library",
"root": "libs/persistence",
"entryFile": "index",
"sourceRoot": "libs/persistence/src",
"compilerOptions": {
"tsConfigPath": "libs/persistence/tsconfig.lib.json"
"assets": [{ "include": "**/*.html", "outDir": "dist/apps", "watchAssets": true }]
}
},
....
Minimum reproduction code
https://github.com/nestjs/nest-cli
Steps to reproduce
- Put assets in a library, and try to use the
assets
in thenest-cli.json
Expected behavior
The assets
should be copied even if they are in a library.
Package version
9.4.2
NestJS version
9.4.2
Node.js version
v20.5.1
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
micalevisk commented
Please provide a minimum reproduction repository. You can start one by running npm init nest
in your terminal