One of the big things that took me a while to understand back in the day is that webpack (and other bundlers/processors) does not expose anything. They expect you to import what you need in each file that is build, and it will build the structure for you. But that does not mean that anything goes outside of webpack. So you cannot access anything from inside the compiled js file from the outside.
This is the reason why you will often see examples that use window. This exposes functions or similar to the global scope.
window.cornerstone = cornerstone
After this you can now access cornerstone on the console or in your inline code.
Here is an example of alpine.js doing it :) https://alpinejs.dev/essentials/installation#as-a-module