简体   繁体   中英

How to expose an object globally with Browserify?

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 .

I found that setting the insertGlobalVars property on the browserify options works lovely for this. For anyone else wondering go to

Defining global variable for Browserify .

There's example code, too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM