Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular application built with esbuild use browser directory as output

I just upgraded an application to angular 17 where the angular.json configuration is the following:

"outputPath": "../SFPD.Workflows/wwwroot",

It's important that the compiled application goes into this directory, however, when using esbuild, it goes into "../SFPD.Workflows/wwwroot/browser" and I can't find the setting to ensure that the "browser" directory is not appended.

like image 593
ssougnez Avatar asked Mar 24 '26 19:03

ssougnez


2 Answers

According to the mentioned Bug Ticket, a solution has now been implemented and is available in Angular>=17.1.x

            "outputPath": {
              "base": "dist/project-name",
              "browser": ""
            },

If you keep the browser property empty, the path will be compatible to the previous versions without the browser directory.

like image 131
gerhardj-b Avatar answered Mar 27 '26 10:03

gerhardj-b


Angular team has updated the Angular CLI design to always output publicly accessible files in browser directory and the ssr files in server directory and other files such as statistics and licenses information in the root output path.

If you are using ASP.NET and Microsoft's SPA template and this update breaks the publish process, then the solution is very simple.

  • Go to the <project_name>.client folder in your solution.
  • Find <project_name>.client.esproj file and open it in a text editor.
  • There should be a build output in the xml document, something resembling $(MSBuildProjectDirectory)\dist<project_name>.client\
  • Update this to $(MSBuildProjectDirectory)\dist<project_name>.client\browser\

Now publish your application, it should create the release bundle without the browser folder in your wwwroot folder.

like image 40
Aravindh Kumar Avatar answered Mar 27 '26 09:03

Aravindh Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!