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
The relative path image in the scss file is not added with base-href after ng build. #27351
Comments
This is working as expected, given that the base-href is exclusively configured within the HTML document. Consequently, all relative resources referenced within the document will be loaded relative to this specified base. |
@alan-agius4 , our project is a micro frontend, if no base-href in image url, can not get img file, because the project base href not in location.url |
In that case you can use the deployUrl option |
In this scenario, an SCSS file (which uses relative paths as background-image value) is not directly included as a component's styleUrls, but rather it is imported from the global styles.scss file using the @import directive. Consequently, after bundling, the image relative paths within this file will resolve only to the file names without any prefix from base-href or deploy-url. |
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?
In ng v10.x, the result of the build is as expected.‼️
The previous version in which this bug was not present was
No response
Description
1、scss file
/* src/style.scss*/
/* this file config in styles of angular.json */
/* src/app/components/foo.scss*/
There is a “face.png” picture in the folder:src/app/components
2、build command
ng build --base-href /login-app/ --deploy-url /login-app/
3、build result
Our project is a micro front-end, the base-href of the project is not included in window.location.url. As a result, the image cannot be obtained after ng build.‼️
4、expect base-href in url
In ng v10.x, the result of the build is as expected.‼️
Minimal Reproduction
commands
ng build --base-href /login-app/
packages
"@angular-devkit/build-angular": "^15.2.9",
"@angular/cli": "^15.2.9",
"@angular/compiler-cli": "^15.2.9",
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: