镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Description

@maks-humeniuk

🐞 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

Activity

  1. alan-agius4 commented on Jan 22, 2021

    @alan-agius4
    Collaborator

    Duplicate of #12186

  2. angular-automatic-lock-bot commented on Feb 22, 2021

    @angular-automatic-lock-bot

    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.

  3. locked and limited conversation to collaborators on Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions