-
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
Multiple configurations assets issue with ng serve #28914
Comments
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. 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 This might be related to your directory structure so its really important to get an accurate repro to diagnose this. |
@alan-agius4 Simple Github repository that reproduce the issue can be found here: |
This is working as intended. When you run the command For more details, refer to the https://angular.dev/reference/configs/workspace-config#alternate-build-configurations. To address this, you can update your configuration to something like this: "serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"buildTarget": "repro-assets-issue-app:build"
},
"configurations": {
"production": {
"buildTarget": "repro-assets-issue-app:build:production"
},
"development": {
"buildTarget": "repro-assets-issue-app:build:development"
},
"clientA": {
"buildTarget": "repro-assets-issue-app:build:clientA"
},
"clientA-staging": {
"buildTarget": "repro-assets-issue-app:build:clientA,clientA-staging"
}
},
"defaultConfiguration": "development"
} Then, invoke the command: ng serve --configuration clientA-staging Alternatively, you can specify the ng serve --build-target repro-assets-issue-app:build:clientA,clientA-staging |
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
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I develop a white label app that should be used by multiple clients. As each client might have multiple environment I set each client assets in a common build configurations as it's persistent across environments and use multiple configuration for ng serve. For example
Serving clientA is used with
ng serve configuration clientA,clientA-staging
. For some reason seems like the assets fromsrc/environments/clientA/assets/
are not included and I see that the browser get 404 error when trying to download an asset from there.What makes me think it is a bug with
ng serve
is that when building the app usingng build configuration clientA,clientA-staging
I see the assets fromsrc/environments/clientA/assets/
are included in the build under the assets folder and that everything working as expected when serving the produced build in a docker.Also note that when changing the order and running
ng serve configuration clientA-staging,clientA
everything working as expected.When used
ng serve configuration clientA,clientA-staging --verbose
to try see some logs I see the logGET /assets/images/brand-logo-light.svg because the client does not accept HTML.
(brand-logo-light.svg
is originated fromsrc/environments/clientA/assets/
) but I really cant tell if it's related.Minimal Reproduction
Create similar build configuration hierarchy as described.
Try serving the app using ng serve with multiple configurations.
See if the assets are shown correctly.
Simple Github repository that reproduce the issue can be found here:
https://github.com/OmerSec/repro-assets-issue-app
Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: