-
Notifications
You must be signed in to change notification settings - Fork 395
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
Make "outDir" for assets more configurable (depth level?) #681
Comments
The root directory for |
@kamilmysliwiec : putting the files in the src folder does not solve the issue in my original project the assets were in the src and the weren't being copied. I just updated the demo repo with the test.html file in the |
@kamilmysliwiec : any news ? |
I also noticed an erratic behavior with the copy of assets. After running some tests I figured out that in monorepo mode, it works when I put the Just to be clear, in my {
...
"compilerOptions": {
...
"assets": ["foo/*"] // <----------- Works fine
},
"projects": {
"api": {
...
"compilerOptions": {
...
"assets": ["foo/*"] // <--------- Does not work
}
},
...
}
} I do not know if this is intended but I would say that the docs are not very clear about it. I am running nest 7.1.2 |
@raydaim When I build your demo repo ( This seems counterintuitive to me, given that the assets folder has to be located in the src folder of one specific project. |
@EkiGui The issue for me is that even when I put the project specific assets in the root |
Can you share your repository ^ from the screen? Unless it's this one attached in the first post |
@kamilmysliwiec : it is the same repository, I updated the file structure to highlight the issue |
I'm facing the same issue when using a library for sharing grpc related code between multiple projects(proto files, clients, etc). As per the code, nest cli copy assets only from the sourceRoot of the project being built. There are no provisions to indicate that the current project depends on assets from outside the srcRoot. I feel there should be an assetDependency option in nest-cli.json to specify the library names those the current project depends on for assets. So when the project being built, cli can copy those assets. |
@raydaim I've pulled your repository again. First, the
it should be:
Next - if you run the For example, if you run The potential solution for this problem would be introducing another configuration option as @iamsuneeth suggested, but I'm not sure if it makes sense(?) since the directories hierarchy (structure) would be preserved (which in most cases is useless after the bundling process) and this will introduce even more confusion. TBH, I think that the best way is to group related assets (pulled from different libs) based on the configuration specified by the host application, not libraries because this structure may vary by application. For now, you can just use this workaround:
at the application level (root level in this particular case). |
@kamilmysliwiec Thanks for the workaround. But a strange behavior is being observed after the above changes. Assets are copied to dist directory for all projects except the one configured as root.
|
My bad, sorry. The path of assets is relative to the src root of the project being built. So I had to specify |
This makes it a bit difficult to work with across multiple apps and libraries. Is it possible to workout which apps depend on which libraries/apps and build according to their config too (tsconfig & asset copying)? Happy to work on this if it applies to the repo. I will need to come up with a solution either way for our large monorepo. |
I'd like a way to copy assets in a monorepo workspace without having to put the files inside each project src folder. I have a single main configuration that's shared between all my apps and I want that file to be available in each app. There doesn't seem to be a way to do this unless I duplicate the same configuration in each project's src folder... |
@dg-eparizzi The workaround provided by @kamilmysliwiec should work. In the root of the nest-cli.json you specify the relative path to the assets that will be included in the all apps dist folder. Take into consideration the relative path is starting from sourceRoot to your assets and is not relative to nest-cli.json. See @iamsuneeth answer. |
I'm submitting a...
Current behavior
Asset are not being copied dist folder if they are included in a library folder (even when they are added to the nest-cli.json)
Expected behavior
assets should be always copied to dist if the file type / folder pattern is included in the nest-cli.json
Minimal reproduction of the problem with instructions
https://github.com/raydaim/NestTest
What is the motivation / use case for changing the behavior?
Cannot include assets with libraries such as fonts / css files ...
Environment
The text was updated successfully, but these errors were encountered: