javascript - browserify 'require' placement -
usually dependencies required in head of file.
var backbone = require('backbone'); var $ = require('jquery');
i wonder if correct require in code body. example: template: require('./home.tpl.hbs'),
module.exports = backbone.view.extend({ template: require('./home.tpl.hbs'), render: function () { ... return this; } });
it's going work, require function taken nodejs world (commonjs modules) , can read best practices in usage here. point need add local variable @ beggining of file , use wherever want.
Comments
Post a Comment