我在require.js中有一个等效的例子,我需要提供动态服务器变量。如何使用browserify执行此操作?
<script>require(['modules/headerNav'], function(headerNav){
headerNav({
/*server side variables here */
fruit:'apple',
size:'large',
type:'empire'
});
});</script>
答案 0 :(得分:0)
我想我已经回答了我自己的问题:
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>