• Resolved Stefano

    (@stefacchio)


    Hi, is it possible to not have jquery as a dependency on the plugin? As of today it is really unthinkable to still use jQuery when you can do the same things with pure Javascript. jQuery is just a brick that slows down sites and I don’t want to have it in the sites I do.

    Thank you so much

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ján Miklá?

    (@neosinner)

    Hi @stefacchio and thanks for reaching out.

    We don’t rely on jQuery for new features. We build them in React instead. However, MailPoet has many pages, and some were built 5+ years ago and require jQuery to function. While it’s possible to rewrite them to React or pure JS, there might be little benefit in doing that.

    Is there a specific reason you wish we don’t use jQuery? By the way, WordPress core is bundled with jQuery, so even if we remove it completely from MailPoet, jQuery will still be loaded by WordPress.

    Thanks,
    Ján

    Thread Starter Stefano

    (@stefacchio)

    Hi @neosinner,

    the reason is that jQuery is an outdated and unnecessary framework that unnecessarily burdens the website, which as of today, needs speed and avoidance of unnecessary payloads.
    WordPress doesn’t load jQuery in the frontend by default but only in the backend, so in my custom theme that I developed, I used only pure javascript and jQuery isn’t loaded as a dependency, but by activating mailpoet it is.
    Unfortunately sorry to hear this response, you should re-evaluate the issue internally and also with high priority as everyone is trying to eliminate unnecessary frameworks to ensure higher speed and high page speed scores, also to ensure more efficient SEO.
    You should completely migrate to React.

    Many people are abandoning plugins and scripts that still use jQuery.

    Let me know.
    Thanks

    Plugin Author Ján Miklá?

    (@neosinner)

    Hey @stefacchio,

    Now I understand the need if you use a theme and plugins that don’t load jQuery on the front end.

    I discussed with the team the option of eliminating jQuery on the front end, but it’s not super easy in our case, and we currently have different priorities. We may get to it in the future, but I don’t have any date for when it could happen.

    That said, MailPoet is open-source, and anyone is welcome to create a pull request to replace jQuery with vanilla JS. We’d be happy to review and merge it.

    Ján

    Thread Starter Stefano

    (@stefacchio)

    Could you kindly tell me where and how can I create this pull request?

    Thanks

    Plugin Author Ján Miklá?

    (@neosinner)

    @stefacchio

    I haven’t checked all the places that needs to be rewritten, but the main file to rewrite is public.tsx. It’s possible that there are other files that are imported into this file, that use jQuery, but that needs to be researched.

    Here is a general guide on contributing to an open-source project, which covers most details on how it works.

    I also recommend reading MailPoet’s README and CONTRIBUTING guides.

    Does that answer your question?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.