D
D
Dmitry Kurmanov2016-10-05 17:29:02
JavaScript
Dmitry Kurmanov, 2016-10-05 17:29:02

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

1 answer(s)
D
Dmitry Kurmanov, 2016-10-07
@duodvk

Thanks @OlmerDale c ru.stackoverflow ru.stackoverflow.com/questions/574458/webpack-%D0%...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question