I've looked online at how to expose a global variable to the window object in Browserify but to no avail. All I found was a really dead Stack Overflow question and blogs. Do I have to do this manually or is there a config option for it like Webpack's libraryTarget option? I have looked for the answer.
            Asked
            
        
        
            Active
            
        
            Viewed 174 times
        
    0
            
            
        - 
                    1Is `process.env` not good enough for your need ? – Fabien Greard Jun 19 '18 at 22:04
 - 
                    Sorry... edited now. – Jun 19 '18 at 22:06
 - 
                    Have you tried `global`? E.g. `global.var = 123` – fubar Jun 19 '18 at 22:13
 - 
                    Thats not what I'm looking for. I'm asking whether or not browserify has some config flags that exposes an object to the global window object, choosing a name like Webpack's `libraryTarget` – Jun 19 '18 at 22:14
 
1 Answers
0
            I found that setting the insertGlobalVars property on the browserify options works lovely for this. For anyone else wondering go to 
There's example code, too.
        romellem
        
- 5,792
 - 1
 - 32
 - 64