ionicons icon indicating copy to clipboard operation
ionicons copied to clipboard

Loading svg fails when base-href set

Open mtraut opened this issue 6 years ago • 7 comments

I am using angular 7.2.2 with ionic 4.6.0.

Everything is fine until i prepare my final deployment where base-href is set to some "/context/path/". Everything keeps working except ionicon resolution, still requesting the resources from "/svg/iconname.svg".

Anything i can do beside hardcoding the src myself?

mtraut avatar Jul 07 '19 19:07 mtraut

Same issue here. Screenshot from 2019-07-25 17-10-20

notyetspecified avatar Jul 25 '19 16:07 notyetspecified

In angular.json

Change: , { "glob": "**/*.svg", "input": "node_modules/@ionic/angular/dist/ionic/svg", "output": "./svg" } To: { "glob": "**/*.svg", "input": "node_modules/ionicons/dist/ionicons/svg", "output": "./svg" }

jereckley avatar Jul 26 '19 03:07 jereckley

@jereckley

In angular.json

Change: , { "glob": "**/*.svg", "input": "node_modules/@ionic/angular/dist/ionic/svg", "output": "./svg" } To: { "glob": "**/*.svg", "input": "node_modules/ionicons/dist/ionicons/svg", "output": "./svg" }

This is not the issue. The icons are in the right place and work on platform builds except browser, i.e. when I have to change the base href from '/' to '/something/'. So the icon source is pointing to https://someurl.com/svg and not https://someurl.com/something/svg

By the way, I'm building using this

ionic build --prod -- --base-href /something/

which results on this on the index.html

<base href="/something/">

notyetspecified avatar Jul 26 '19 09:07 notyetspecified

@jereckley @mtraut

This was already fixed on 4.6.1 https://github.com/ionic-team/ionic/issues/18737#issuecomment-509634336 Just updated the package and it's all working.

Cheers

notyetspecified avatar Jul 26 '19 09:07 notyetspecified

Sorry for the confusion... I was on 4.7.0 and I was having the problem and it didn't matter what the base ref was. This was the fix for me. Thanks.

jereckley avatar Jul 26 '19 14:07 jereckley

I am also encountering this issue.

roGreenRock avatar Oct 04 '19 04:10 roGreenRock

This issue has been labeled as help wanted. This label is added to issues that we believe would be good for contributors.

If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.

For a guide on how to create a pull request and test this project locally to see your changes, see our contributing documentation.

Thank you!

ionitron-bot[bot] avatar Apr 21 '25 16:04 ionitron-bot[bot]