1

The code I've created is being added to a larger code base that is expecting a particular variable name. I'd like to be able to minify my code while maintain a single variables full name.

I'm aware of the window["myVar"] trick however the larger code base is expecting the value of myVar to be a assigned to a particular value calculated by my code.

mick.io
  • 421
  • 5
  • 9
  • You don't want to create a solution like this, it will be a black box changing some kind of state in minified code, which is very hard to debug. Alternatively you can emit an event which other code can subscribe to. – A1rPun Aug 05 '19 at 21:31
  • This question has an answer that may help you: https://stackoverflow.com/questions/37656592/define-global-variable-with-webpack – Stephen Collins Aug 06 '19 at 03:56

0 Answers0