Despite there are a lot of relative questions, they do not answer how to resolve the following issue.
I have a nodejs file index.js.
var browserify = require('browserify');
var data = getSomeData();
browserify('entry.js').bundle();
I want so that data
could be accessed in entry.js
. I found browserify option insertGlobalVars
but I could not find any proper documentation or examples. I tried {insertGlobalVars: {myVar: someData}}
but it does not work.
I could not call require('someData')
because my data is produced only when executing index.js
.
Update: Data is an array; key is a file name, value - file content (size is about 500b).