-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Flatten glob "assets" to one output folder #14158
Comments
Hi, thanks for reporting this. Thinking about this more flattening the assets output is dangerous as this might cause file collisions since non of the assets files gets fingerprinted and a file with the same name can exist in a different nested folder. |
It would be nice to add this as an option, similar to CopyWebpackPlugin |
@alan-agius4 You're right that file collisions can be an issue but printing a warning to the console on build might be enough. In the end it's the developer's responsibility; if we are specifying we want all files in one folder, we couldn't have duplicate file names even if we were using any other build tool. |
Django (python web framework) also does this and takes care of the collision via teaching the users a naming convention. E.g.:
By adding a subfolder with the same name as the nested module, there should be no collisions. I also would prefer using module local assets for some modules. It matches the whole lazy loading isolated module structure idea, is what I think. |
The problem is that so far the cli cannot handle references to src in html. |
I think cli should learn vue cli in this regard. If the file is in a specific folder, only copy it. |
I have observed that html references are not processed at all, I think this is a design error |
Any updates on this feature? |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage. We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package. You can find more details about the feature request process in our documentation. |
fun fact, the new vite/esbuild based build does exactly this. One side effect is though: If you have two files with the same name in different folders, you get a build error. |
🚀 Feature request
Description
I am currently working with nested assets folder per entity map. Currently, I am using the following assets export settings:
Imagine having the following file structure:
What I get
This would result in the following
dist/
file structure:What I want to have
What I have tried
I have tried to use a custom script to move the assets files manually in a flatten way to the dir folder.
This, however, does not work in combination with
ng serve
as the files are in-memory, and also does not work with theng build --watch
as I am unsure how to activate script after it has been built.I would love to get some insight into the best approach. Maybe this is simply using an already existing flow. From my point of view, this should be included as functionality, as the nested folder structure strategy seems to be one of the more common approaches.
The text was updated successfully, but these errors were encountered: