mardi 20 mars 2018

Addon asset url's wrong when server ember app at different rootUrl

I created a custom addon.

A couple of images in vendor/assets/img folder, which I import in my index.js's included method app.import('vendor/assets/img/loading.gif'); And then use it in my addon as img src, such as img src="/assets/img/loading.gif" id="searchSpinner" style="display:none" />

This works fine when I test it in my dummy app. It also works fine when I use it in an ember app after linking the addon.

However, what I'm doing is have an asp.net mvc app serve up my ember app (result of a prod build) I had some issues there with css/img/js links but sorted it out with the app itself (basically just setting ENV.rootUrl in environment.js) However the image links in my add on (addon in emberapp in mvc app) is wrong.

Is there another step to ensure the urls of your addon assets is correct, no matter where it's being used?

For instance now, in my ember app the link to it's own js is correct: <script src="/mymvcapp/testember/assets/site-app-bbaea1133474bb804e19476f27eeda30.js"></script> However the link to an image futher down in my addon used in the ember app is wrong: <img src="assets/img/loading-5fe0e55f8e19bc4cc3201876dce7b224.gif" id="searchSpinner" style="display:none">




Aucun commentaire:

Enregistrer un commentaire