-
Notifications
You must be signed in to change notification settings - Fork 12k
Angular CLI is giving error - Can't resolve '/assets/***sharedfonts/open-sans-v15-latin-300.woff2' after updated to Angular 10 #18043
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
Comments
Duplicate of #18013 |
Duplicate of #18041 |
Hi @alan-agius4 I am sorry i m disturbing you again but nothing solved my problem
So this works on localhost but not on production mode. But before in Angular 9.1 i did nothing and i was using ~ like this
and it was working on both localhost and on production mode. |
@ErVishalM, without a reproduction and the needed information it's hard to tell what's happening. |
Hi @alan-agius4 , check url which i marked (It is giving me error on production server) url should be coming as (Expected Output) as this was coming in before in Angular 9. I was using url in styles.scss as |
Hi @alan-agius4 , have you checked this Can you please reopen this issue as you said it was a duplicate but in those issues also I'm getting the same error in Angular 10. May be anyone not used |
@ErVishalM, I’ll take a look on Monday. |
Hi, @alan-agius4 according to upper mentioned issue best way to use relative path in css but because of this all the files are copied to the root folder which is very difficult for large application there can be so many files so all files will be copied to root folder like this But before in Angular |
Hi @alan-agius4 , any update on this. |
Hi @ErVishalM, This is working as expected. When using root paths If you wish that processed assets are not placed in the root of More information about these options can be found: https://angular.io/cli/build |
Hi @alan-agius4 , Thanks for the reply. In my case assets are already coming in
which was working and all the assets were coming in now why its not working in If i use this Assets should be coming in |
@ErVishalM, having the base href inlined in the bundle when using root level paths ie paths starting with a Since version 9, the base href value is not included in the final css file unless opting in the deprecated behaviour mentioned above. See: #14587. The In most cases users should rely upon the build system to process and emit assets referenced in CSS. Paths starting with |
@alan-agius4 , with due respect as you can see there are so many people waiting for correct answer and as your are saying all we are using a non standard method and |
@ErVishalM, the recommended approach is to use either relative paths were the assets will be processed out-of-the-box by the build system or use root paths if you want to load assets which are not relative to your base-href where you will need to copy the assets manually using |
@alan-agius4 , Thanks for the information. Forget it. Thank you so much for helping me in a way. 👍😊 |
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. |
Hi,
I just updated to

Angular 10
and before this i was usingAngular 9.1
and this was working fine inAngular 9.1
now angular cli is throwing error thatCan't resolve '/assets/***sharedfonts/open-sans-v15-latin-300.woff2'
If i remove the ~ then it is working fine on local server but it is not replacing relative path in styles.d17173f9650483347d45.css production css file.
So because of that i am getting error on production server if i remove ~

Previous Angular 9.1 styles.css production file angular cli was automatically adding my href (MyProject) in path


Angular 10 styles.css production file angular cli not adding my href (MyProject) in path
Adding this ~ before
/assets/
i got this answer from herePlease help me what am i missing? Is there something i need to do?
The text was updated successfully, but these errors were encountered: