Since I do not want to have a bunch of output JavaScript files as a result of compiling TypeScript, I am considering a Webpack for writing TypeScript NodeJS libraries. The result of implementing such a technique in most cases it will be possible to get a single index.js at the output. I repeat once again: in this question we are not talking about browser-based web applications, but about nodejs applications.
If you just build a Webpack with the node_modules / some_dependency / index.ts below , the Dependency class will not be visible in index.babel.js , because by default Webpack does not create a variable that is accessible from the outside.
index.babel.js
require('@babel/register'); // node_modules/some_dependency/index.js (откомпилированный TypeScript) import Dependency form 'dependency'; // Error! new Dependency(); node_modules / some_dependency / index.ts
export default class Dependency() { // --- } Unlike a web application, we have NodeJS modules, and in addition the source code in TypeScript. How to ensure the visibility of the class Dependency inside index.babel.js ?