Yes, you are correct.
For the bundle issue, if you are able to run just the JS application independently without any issues, it could be that there is a variable which is in global-scope, but is not part of your JS application. (Maybe present in some OOTB clientlib or a dependency/embedded clientlib...