1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

After upgrading to Angular 20, images are served from /.angular/vite-root/ from LocalHost

Discussão em 'Angular' iniciado por Brian Kitt, Junho 13, 2025.

  1. Brian Kitt

    Brian Kitt Guest

    I was at Angular 14, and images were serving fine when running LocalHost. They are stored in the Assets folder of my project right off of 'src'.

    A month ago, over the course of a day, I did every upgrade step by step from 15 to 20. By the book, not skipping a version, not skipping any steps.

    I am now at latest version of every dependency and Angular 20.0.3. Also running Node 24.2.0

    However, no images show up in LocalHost, although when I deploy it, the images show up just fine.

    Note, the deployed code works perfectly and is in fact, running in production. It went through QA, all testing was successful and everything worked perfectly.

    I just can no longer see images when running localhost. I'm not sure which version of Angular broke it. I did all of the upgrades at one time, so that I could reduce the amount of testing that was required. After I got all of the changes to Prod, then I decided to try to figure out the LocalHost issue, since this issue doesn't affect deployed code.

    I ran SystemInternals process monitor to figure out why they are not showing up. I discovered they being looked for in /.angular/vite-root/{ProjectName}/Assets/{imageName}

    I never installed Vite. Vite is not a dependency in Package.json, although, I do see v6.3.5 in Package-lock.json. I don't understand why suddenly the images are being looked for in that folder. What have I done wrong?

    I then tried to install Vite to see if that would solve it, and then I started getting 403 errors that the files were being served from a folder outside the project. Even with Vite installed, they are still served from the .angular folder. I then backed off that approach and revered back to the commit before I installed Vite. (Note, it is still in package lock).

    I really just want them served from where they reside, which is in the assets folder.

    I've spent hours digging through posts online, and really can't find a solution. Any ideas where I can go with this?

    I'd be happy to post code, but I'm not even sure what to post. Since I never installed Vite, I don't have a config file that can be wrong.

    When I did try to create a config file for Vite, I simply could not get it working without the 403 errors. I spent hours trying to resolve the 403 errors and couldn't get past them.

    Continue reading...

Compartilhe esta Página