-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[es-build] Browser directory created in outputPath #26304
Comments
This is by design. The application builder will output publicly accessible files in the In .NET Core you can configure and change the Edit: If this change in |
Thanks for the tip. However, I still find it a bit weird (but maybe I'm alone). If I configure an output path, I expect angular to scrupulously respect it. Especially if I don't use SSR. What would make more sense to me would be to have a SSR section in the angular.json where I could override the default output path. This way, people could use the regular outputPath setting to have the same behaviour than with webpack and use a combination of the two if they want to use SSR. With this approach, everyone would be able to configure his application the way he wants. Just a suggestion... |
The main reasons behind this change of having a standardise output are;
Whilst this change does remove some flexibility, we believe that the pros outweigh the cons in the long run. |
I run in same issue. I am using Firebase for hosting and after moving to I prefer to use SSR. It is Thnx |
@olostan, if you are using AngulsrFire Although it does look like they are still working on supporting the new builder firebase/firebase-tools#6480 |
@alan-agius4 Thnx! Looks like it is exactly what I am missing. |
Trying to use esbuild has being absolute hell. I don't use ssr (can't even install node in server) but having this browser directory has introduced so many unnecessary problems. |
I am having problem with the browser folder too. I build and output to ../webapp folder in spring boot application. The 'browser' inside ../webapp ruin everything. Developers use Angular to build for many types of applications, not necessarily must use /browser or /server. 'browser' should not be here or at least should have the option not to have it. |
Big problem for me too. :( Please consider adding an option as a parameter in angular.json. If the parameter is set to an empty string, the output should be directed to just /dist. If the parameter is set to 'browser', then the output should go to the /dist/browser subfolder. |
+1 maybe it's more friendly and a better experience for the developers to make it configurable in addition to the default behavior |
As a current hack I currently use this. It is strange but works: Change angular.json: Add in package.json - scripts Add post-build.js file in root: |
+1 Problem here too, I also deploy Angular with a Spring Boot application and all of our pipelines are setup so that Angular builds as part of CI/CD and the output path is set to I don't think I even saw this change mentioned in any of the notes, but I may have missed it. If the behaviour isn't going to be looked at/changed/made configurable then maybe it's worth mentioning this more clearly so people upgrading don't blindly cause headaches for themselves. I agree that there should perhaps be an option for client-side rendering to output in the previous directory structure. |
Same here, everything in pipeline is breaking because of forced "BROWSER" folder which does kill of all middleware proxy and base-href stuff set up (eg. relative to ./api json fetch logic) . Please give an option like before to be able to customize the real dist outputPath without forcing devs. why not in angular.json:
it's not so easy if you pipe in 5 SPA apps/uis into one wwwroot with the .UseWebRoot .NET change - which also |
If the change in output path is a major obstacle for adopting esbuild/Vite, we recommend using the To be clear, the motivation behind this change for |
Building with browser-esbuild show a warning:
Will it get removed in the future? |
@clydin, I wonder we should remove/rephrase that warning? We should definitely prefer |
|
Upgrading to Angular 17 is now breaking all the spring boot apps. Forcing devs to accommodate a change like this(using the browser folder) rather than making it as an option provides more headaches than solutions. As @Crefelder suggested, now we have to 'hack' our way for a work around. This isn't an ideal solution. Please find a fix to this problem, or at the very least, provide it as an option so it can be configured. |
I am running into the same issue when upgrading to Angular 17. This forced “BROWSER” directory has introduced a lot of unnecessary problems. Please consider giving an option to be able to customize/configure the dist outputPath. |
+1 As a temporary solution I have to modify Please consider adding an option in angular.json. |
I'm seeing a lot of feedback in this thread asking Angular CLI to support an option to drop The If your deployment pipeline is giving you trouble with |
It is deprecated, it's just a temporary solution, not an "option". ng build says:
|
That log statement was an artifact of prerelease builds. It's already been removed in #26402 and should be published today in 17.0.2. Angular docs state this the best I think:
|
thank you for the clarification, @dgp1130 ! |
I also encountered the same situation as you, which forced me to make some changes to my project |
helpful to me |
For anyone using Asp.Net 8.0 where you have .client and .server subdirectories in your Solution - go to the
Then re-deploy and it should fix it |
No, see this comment. |
I don't understand your position here. Are you going to support this workaround? In my opinion, the best way to maintain it is to add a flag in Angular CLI or make Angular CLI smarter. @e-oz , you won't lose anything if Angular CLI becomes better and be able to honor the |
@changhuixu right now there is no such option as There is one issue with Because this issue is already closed, I've created another issue to report this problem. |
I've created a feature request, you might want to track it: |
And it's implemented: #26675 |
There are already differences between browser-esbuild and application. For example the new "loader" builder option was added to the application builder but not to the browser-esbuild builder. |
Depending on your IDE, this can be an issue. For example, Eclipse will not pick up changes from VSCode, so you will have to manually refresh the Java project to update the web app every time you build or watch your Angular projects. However, if you build to the "webapp" folder, Eclipse will detect the changes automatically. |
Fixed in angular >=17.1.x
Keep the "browser" : "" value empty if you don't need the default folder browser being added. https://angular.io/guide/workspace-config#output-path-configuration |
This doesn't seem to work for me on 17.1.1.
and also can't be an empty string.
|
Can you share the angular.json or configuration |
Using But for reference I was using exactly the same options for With
I get
And with
I get
|
If I don't provide Like I mentioned though |
Did you change Maybe related https://angular.io/guide/esbuild#using-the-application-builder Once the builder name has been changed, options within the build target will need to be updated. The following table lists all the browser builder options that will need to be adjusted or removed.
|
I did but then removed it.
|
Yes it's correct, But maybe have to add browser : "" inside outputPath since it's not included in the migration |
this works for me too. thank you |
This comment was marked as outdated.
This comment was marked as outdated.
that will obviously work, but we have to do it manually all the time, anyways not this issue has been fixed now |
There is an issue, however. If I pass the --output-path in the CLI – the browser folder is created. And there is no option to specify for it to be not created. |
This fixes Angular not being served up correctly. Note, special configuration in Angular is necessary to get the build output into the ui/ directory. Refer to: [Output path configuration][1] and [browser directory created in outputPath][2]. [1]: https://angular.io/guide/workspace-config#output-path-configuration [2]: angular/angular-cli#26304
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I have an Angular application configure as below:
"outputPath": "../MyNetApplication/wwwroot",
When using webpack build, the compiled files of the Angular application went directly in wwwroot so I could publish my .NET application and it worked directly.
I tried to switch to es-build, however, after the build, the compiled files of the Angular application end up into "../MyNetApplication/wwwroot/browser" which prevents me from publishing the .NET application as this would not work.
It seems weird to me that the outputPath settings of angular.json is only partially honored.
According to me, this settings should be used and not altered during the compilation.
Minimal Reproduction
Just create a new Angular application using angular/cli 17 and run ng build.
The files will be located under dist/ng17/browser.
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: