Install tampermonkey and add the following UserScript with one (or more) @match
with specific page url (or a match of all pages: https://*
) e.g.:
// ==UserScript==
// @name inject-rx
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Inject rx library on the page
// @author Me
// @match https://www.some-website.com/*
// @require https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.5.4/rxjs.umd.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.injectedRx = rxjs;
//Or even: window.rxjs = rxjs;
})();
Whenever you need the library on the console, or on a snippet enable the specific UserScript and refresh.
This solution prevents namespace pollution. You can use custom namespaces to avoid accidental overwrite of existing global variables on the page.