I need to use a number of co-dependent ES6 classes in a web page, where development will be continued. For various reasons, the remainder of the development must happen in a browser-compatible environment. That is, I will be writing 'vanilla' javascript to be run in a script tag that uses these existing classes. I will NOT be using any more ES6 features developing this part of the JS.
I've already tried using babel and webpack to transpile my code into browser-friendly javascript. However, webpack renames and minifies the javascript so that it is virtually impossible to do any more extended development. Optimally, the classes that I defined in my ES6 code will remain exposed (as plain prototypal functions) as interfaces.
As an example, suppose I have some ES6 class BinaryOperation
and a class Number
(I know this exists in JS, but just as an example). These classes are defined in two separate JS files and have their own constructors. The "Number" class is a dependency of BinaryOperation
and is imported. BinaryOperation
has a number of functions in the class. I would like to be able to bundle both classes and their functionality into a single browser compatible file. This file would let me create BinaryOperation
objects in my browser code using the new
keyword, like I would for any non-es6 object prototype. What tools will help me accomplish this?