Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
serverRender: function(moduleName, props, bundlePath) {
var module = require(moduleName);
var component = module(props);
var markup = null;
React.renderComponentToString(component, function(m) {
markup = m;
});
if (markup.indexOf('') === -1) {
throw new Error('Must have in the generated page to insert JS');
}
markup = markup.replace(
'',
'' +
''
);
// Get staticify CSS if it's there
var g = eval('global'); // bypass Browserify's auto-global
if (g.__staticify_css) {
page.bootstrap(function(err, data) {
if (err) return cb(err);
React.renderComponentToString(page, function(markup) {
cb(null, markup, data);
});
});
}
page.bootstrap(function(err, data) {
if (err) return cb(err);
React.renderComponentToString(page, function(markup) {
cb(null, markup, data);
});
});
}