How can I properly enqueue wp-hooks without issues?

I figured it out. To save you a long ass explanation, the hooks.jswp-hooks file is registered as a default_script inside the load-scripts.php file. It’s considered a default script and from 5.0, it’s included with every install, but if you’re looking to use this as a standalone script for 4.9 for example, do as follows:

  1. Grab the distribution file from: https://github.com/WordPress/WordPress/blob/master/wp-includes/js/dist/hooks.min.js (you need es-2015 polyfill from Babel for forEach and some as far as I see if your stuff is going to be used on <= IE11).
  2. Place it somewhere and just enqueue it the normal way under the name wp-hooks.

…and hope there are no conflicts.

That’s it. You now have access to wp-hooks.

tech