How to remove members related JS

I have members enabled without stripe.
How can I make ghost not to load stripe related scripts and requests?
Also how could I make ghost not load /public/members.js?

4 Likes

There’s no way to currently disable that! We should deffo not add in the stripe scripts unless they’re going to be used though - I can understand that.

What is the reason for not wanting to load /public/members.js?

I wrote my own “members.js”. The included one does not fit my UI. It presumes my UI uses certain classes or that I should write that css/dom stucture to fit the code in members.js

Also, why some requests are made to api endpoints like /ghost/api/canary/members/send-magic-link/ and another request is made to non api endpoint /members/ssr?

Ah that’s not recommended right now - the API we’ve exposed by using data-members-* attributes is the documented and official way of interacting with the members feature from the frontend - if you circumvent this, the underlying structure can/probably will change.

Out of interest which bits in particular do not fit your UI? Members does not require you to use certain classes, just needs data attributes added to the relevant elements.

Some of the requests are made to the API because they are API specific, for example creating members/stripe sessions. The requests made to the frontend are frontend specific, usually concerning the session. Though these endpoints are undocumented and should not be considered stable for developing against!

2 Likes

Hi, i was looking for the same issue. Stripe related scripts should only load when API key is added. This makes much more sense.

I guess i have to disable whole members thing.

PS: I am new to Ghost.

I am seeing the same problem. Stripe is being included even though I’m not using it. In my pagespeed tests I am seeing I can drop about a second off my load time if I can remove it from my pages.

This seems like a trivial fix. Any change this can be included soon?

1 Like

This should be fixed, if possible, please

Any updates regarding this?

@fabien - Me too landed here looking for how to stop loading Stripe scripts when not used. Is there a plan to fix this? Or, a workaround?

There’s a PR in progress :wink: