JS plugins not loading correctly

Hi,

Since last week or so my discourse is having trouble loading JS plugins.

What is strange is that they are indeed loaded correctly in the Network tab:

I am getting errors such as
TypeError: e.find(...).not(...).magnificPopup is not a function

TypeError: window.Chart is not a constructor

It seems that stuff getting loaded via loadScript("/javascripts/jquery.magnific-popup.min.js") are not loading correctly.

Discourse version: v2.2.0.beta2 +184

Does anyone have a clue as to why this might happen or steps to debug this? Thanks!

1 Like

Do you mean from a customization or plugin, or are you referring to a plain vanilla install?

The front-end should be vanilla except for two script inclusions that aren’t causing errors.

Core features like the /admin dashboard charts aren’t displaying.

Is this on your local environment or on a live site? Also, can you confirm that you have the Chart.min.js and jQuery.magnific-popup.min.js in the /public/javascripts/ folder?

You can see it live in most posts, e.g. https://www.robotshop.com/community/forum/t/mini-sumo-at-the-next-ny-makerfair/33003/3

The file is there and you can see from the network tab that it’s loading: https://www.robotshop.com/community/forum/javascripts/jquery.magnific-popup.min.js

Hmm, interesting. There are no images in the topic you linked above, so I don’t see what’s triggering the magnificPopup call.

1 Like

I am looking at our previous stable environment and it seems that those issue might have started to appear when we moved from: Discourse 2.1.0.beta4 -> Discourse 2.2.0.beta2

Hey @rbrlortie, a recent change to loadScript is not working as expected for subfolder installs, but I have identified the issue and submitted a fix.

Thanks for the report, and I will let you know when it’s ready for update!


PR for reference:

https://github.com/discourse/discourse/pull/6474

8 Likes

Awesome! We are awaiting your go to update our instance. :grinning:

2 Likes

The fix is in test-passed :muscle: Feel free to update anytime now. Thanks again!

7 Likes

This topic was automatically closed after 4 days. New replies are no longer allowed.