Open pshurygin opened 3 years ago
Hi @pshurygin, I tried to replicate this locally, but I am not managing to replicate the issue.
Can you setup a minimal repro please?
You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app
and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
This might be related to your directory structure so its really important to get an accurate repro to diagnose this.
@alan-agius4 Are you using actually different images for that? If so, I guess one might also need to have import of the second asset from a different(lazy loaded) chunk, as this is how we have it in our repo. I will try to make a minimal reproduction repo for that.
Yes, the 2 images are different.
@alan-agius4 Yes, you need your second asset to be in a different bundle. I've also didn't mention that you have to run build in development mode, otherwise file names are hashed. Here is the reproduction repo
child.component.scss
NG_PERSISTENT_BUILD_CACHE=1 ng build --configuration development
child.component.scss
NG_PERSISTENT_BUILD_CACHE=1 ng build --configuration development
againHi @alan-agius4, I would like to provide a data point that this issue still persists. This thread helped me to solve a similar issue which was caused by two independent third-party dependencies adding equally named static assets to the build (fonts). Luckily, one of the dependencies could be replaced but if that was not the case, we would have been forced to disable angular caching for local development.
π Bug report
Command (mark with an
x
)Is this a regression?
No
Description
This issue is a continuation for the https://github.com/angular/angular-cli/issues/12186. The fix, introduced for that issue, does not correctly work when using webpack 5 persistent cache.
The problem comes from the fact that when you have multiple assets with the same name, but different folder, CLI emits the first visited asset to the root of fs(disregarding it's folder path), while emiting subsequent assets with this name to their corresponding folders.
To do that Angular CLI keeps track of the emitted(visited) files in-memory, and it does not work when part of the compilation was restored from file system cache. This makes it so that CLI does not realise that a certain svg file was previously emited to the root of the fs, which in turn may lead to the emition of a different svg file(with the same name, but different content) to the same place in the root of the fs, triggering webpack emit conflict error.
π¬ Minimal Reproduction
π₯ Exception or Error
π Your Environment