Skip to content

Two output files share the same path but have different contents: media/img.svg [plugin angular-compiler] #26347

@ln-e

Description

@ln-e

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

It is not possible to import in SCSS two or more files with the same name but located in different folders when using new esbuild builder@angular-devkit/build-angular:application during serve.

.main {
  background: url('../assets/subdir1/img.svg');
}
.content {
  background: url('../assets/subdir2/img.svg');
}

And problem appears only during serve, production build works as expected: its generate 2 different images in media folder with different hashes.
The only possible workaround I found is adding "outputHashing": "media" to development configuration.

Minimal Reproduction

https://github.com/ln-e/ng17-image-import-bug

  1. Clone repo
  2. npm run start

Exception or Error

✘ [ERROR] Two output files share the same path but have different contents: media/img.svg [plugin angular-compiler]


Application bundle generation failed. [1.409 seconds]

Your Environment

Angular CLI: 17.0.0
Node: 18.16.1
Package Manager: npm 9.5.1
OS: darwin arm64

Angular: 17.0.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0
@angular-devkit/build-angular   17.0.0
@angular-devkit/core            17.0.0
@angular-devkit/schematics      17.0.0
@angular/cli                    17.0.0
@schematics/angular             17.0.0
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.2

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions