Currently, our team is in the process of developing a custom JavaScript library for integration with one of our flagship products. The development workflow involves:
- Utilizing TypeScript and internal modules to create namespaced classes (internal and public API namespaces) using
/// <reference>
tags for dependency management - Compiling ES5 targeted JavaScript (using the
--out
flag) from_references.ts
, consolidating and minifying into a single js file - Automatic documentation generation through the use of generated
.d.ts
files for the public API
We are exploring options to modernize our codebase and considering adopting newer features of TypeScript such as leveraging a unified tsconfig.json
and embracing ES6 modules. However, certain challenges have been identified:
- ES6 modules appear to require maintaining a specific directory structure, potentially jeopardizing our existing namespaces. Concerns arise regarding future compatibility on ES5 platforms.
- Investigation into implementing
browserify
has been attempted to bundle the library components together. Yet, an entry point issue arises as the library consists mainly of class declarations without a designated starting point.
Are there key insights missing that could enhance our understanding? Is the adoption of ES6 classes viable for our objectives, and if so, what would be the recommended tooling approach? Should we stick with namespaced classes for achieving the desired output?