I would like to manipulate a javascript object that is created by another script on the page. This script is a fairly large webpack bundle, and all the variable names that get used in this bundle do not seem to actually be in use on the web page – as far as I can see by running console.log(varname) on them, which always returns undefined.
I tried going through the options offered when starting to feed console.log with a name, but nothing came up that looked too promising (I tried some options but found nothing helpful).
Some background information on what I am trying to do: I am working with Grav, a flat file CMS, which in its Admin plugin uses a CodeMirror editor, among many other scripts. All the scripts are webpack bundled into admin.js and vendor.js (CodeMirror seems to be contained in the latter). I would like to use a CodeMirror addon and some different CodeMirror options, all of which is easy to do with standalone CodeMirror code – but I can't figure out how to get to the CodeMirror object in Grav Admin.
Your ideas are much appreciated! Thank you for your time.
Generally speaking, anything using webpack is likely to be only using variables scoped to the modules inside it. Modules are designed to they don't shove variables into the global scope (where they might clash with variables from other scripts).
It you want to change the way the script works, get the source code for it, edit it, then compile it with webpack again.