In my opinion, JavaScript is not the appropriate technology for writing the core business logic of large, mission-critical systems. The language was originally devised in order to make a "beginner-friendly" scripting engine available in the browser, suitable for quick manipulation of forms and multimedia on simple, single-page, Web 1.0 content. Consequently, it was never designed with large-scale architecture, cross-language interoperability, out-of-browser use cases, or runtime efficiency in mind.
To this day, I think only the efficiency problem has been solved. That is unsurprising, since compilation and optimization is an implementation detail that doesn't affect what code users are allowed to write, and JS engines have improved performance enormously during the 3 decades of the existence of JS.
However, the lack of foundational elements and the insufficient amount of thought given to the aforementioned issues at the birth of the language make it very hard to bolt such features onto it after the fact. It has nevertheless been done, e.g.: JS now has a module system – at least three of them, just to make life easier (and bundlers existed even before those attempts); traditional class-based inheritance was added as a redundant way of writing OO code in addition to prototypal inheritance; package managers aren't lacking either (there is NPM but also Yarn); type systems for JS and typed languages compiling to JS have been devised (TypeScript, CoffeeScript, Elm, even C and C++ via Emscripten, Dart, Flow, PureScript, just to mention a few).
However, many of these efforts (notably, module systems and type systems) really couldn't be implemented comprehensively, soundly, or conveniently, exactly because the original design of JavaScript lacked any and all regard for them, so bending the language (and its entire ecosystem) in a backwards compatible way and at the same time supporting completely unforeseen use cases has become borderline impossible.
This is why I generally find it egregious that there is a high amount of tooling and boilerplate required just to call a JavaScript app setup "modern". You need a package manager and a type system for your JavaScript, because the code base and the team managing it is so big? That's a code smell, because projects of this scale and importance were never meant to be written in JavaScript. One should write in JavaScript what one can keep in one's head without having to resort to unofficial, external tools and more or less ugly hacks. Anything more complex calls for something more suitable for the problem being solved.
Alas, the majority of people (or at least the majority of JS programmers) will disagree with me, because in their point of view, JavaScript is the perfect language since it's "easy". I think there is much more to ease of use than a very lenient compiler and a dynamic type system, which only make languages superficially easy (and the written code hard to maintain and debug); but apparently, that is what most programmers currently care about anyway.