Answer the question
In order to leave comments, you need to log in
Webpack: How to put all functions/variables with export keyword into one global variable on build?
I also wrote a question on the stack, perhaps this option will seem clearer to someone:
I'm changing the typescript library build method from *gulp concat* + *typescript compiler* to *Webpack*. And I implement *es2015 modules*.
The library can now be used with `require/import`. And also it is necessary to leave the possibility to use the library by adding a classic script to *html header*.
Previously, all *functions/variables* were hidden in the `Survey` global variable. For this, *typescript* namespaces `namespace Survey {}` were used and all classes or variables that I wanted to give out had the export keyword.
I removed the namespaces and migrated everything to *es2015 modules* and now to get the same global variable I had to include the imports of all required classes/variables in the *webpack* build entry point:
https://github.com/dmitrykurmanov/surveyjs/ blob/ma...
Is there any other way to achieve the same without creating such a huge and horrible file?
Answer the question
In order to leave comments, you need to log in
Thanks @OlmerDale c ru.stackoverflow ru.stackoverflow.com/questions/574458/webpack-%D0%...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question