I am changing the way to build the typescript library with gulp concat + typescript compiler on the Webpack . And I implement es2015 modules .
Now the library can be used with require/import . And also it is necessary to leave the possibility to use the library by classic adding a script to the html header .
Previously, all functions / variables were hidden in the global variable Survey . For this, we used the namespaces typescript namespace Survey {} and all the classes or variables that we wanted to give out had the export keyword.
I deleted the namespaces and transferred everything to the es2015 modules and now, to get the same global variable, I was forced to include imports of all the necessary classes / variables in the input point of the webpack assembly:
https://github.com/dmitrykurmanov/surveyjs/blob/master/webpack/reactStandardIndex.js
Is there any other way to achieve the same, but without creating such a huge and terrible file?