I have an equivalent example in require.js where I need to supply dynamic server variables. How do I do this with browserify?
<script>require(['modules/headerNav'], function(headerNav){
headerNav({
/*server side variables here */
fruit:'apple',
size:'large',
type:'empire'
});
});</script>
I think I have answered my own question:
https://github.com/substack/node-browserify
<script src="bundle.js"></script>
<script>
var through = require('through');
var duplexer = require('duplexer');
var myModule = require('my-module');
/* ... */
myModule({/* dynamic server variables here...*/});
</script>
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.