Skip to content
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

Assets with the Same Name, but Different Path, are Copied Over Each Other #19850

Closed
2 tasks done
maks-humeniuk opened this issue Jan 22, 2021 · 2 comments
Closed
2 tasks done

Comments

@maks-humeniuk
Copy link

maks-humeniuk commented Jan 22, 2021

🐞 Bug report

Command (mark with an x)

  • serve
  • build

Is this a regression?

I don't know, since never needed this before.

Description

Assets with the same name, but different path, are copied over each other on ng serve or ng build --prod with "outputHashing": "none".

🔬 Minimal Reproduction

.dark {
  background-image: url('../../../assets/images/dark/logo.png');
}

.light {
  background-image: url('../../../assets/images/light/logo.png');
}

Both images will be copied to the output directory with the same name, so you only get the dark or light logo, that will be used in both cases.

This won't be an issue on ng build --prod with "outputHashing": "all" or "outputHashing": "media".

This also won't be an issue on ng serve --prod, as per this comment, but will definitely slow down local debugging.

This could be fixed by using assets relative path (/assets instead of ../../../assets), but then it would be an issue on ng build --prod, since I don't include assets/images in assets in angular.json. The reason is that I don't want them to be duplicated (in assets and root folder), and this is by design, as per this comment.

🔥 Exception or Error

WARNING in Conflict: Multiple assets emit different content to the same filename logo.png

🌍 Your Environment


    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 11.0.7
Node: 14.15.0
OS: win32 x64

Angular: 11.0.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.7
@angular-devkit/build-angular   0.1100.7
@angular-devkit/core            11.0.7
@angular-devkit/schematics      11.0.7
@angular/cli                    11.0.7
@schematics/angular             11.0.7
@schematics/update              0.1100.7
rxjs                            6.6.3
typescript                      4.0.5
@alan-agius4
Copy link
Collaborator

Duplicate of #12186

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants