recipe/view.js
function writeLaunchCode(config) {
  var { name, stub } = config.holder
  if (!name || !stub) {
    throw new Error('invalid name or stub')
  }
  var code = `
    ;(function () {
      var root = document.getElementById('${name}');
      if (!root) throw new Error('undefined ${stub} root');
      var view = window.${stub}.entry;
      if (!view) throw new Error('undefined ${stub} view');
      ReactDOM.render(React.createElement(view), root);
    }());
  `.replace(/\n|(\s{2})/g, '')
  var output = path.join(config.$path.target.client, 'launch.js')
  fs.writeFileSync(output, code, 'utf8')
  logger.done('view ::', 'launch code generated')
}
function writeLaunchCode(config) {
  var { name, stub } = config.holder
  if (!name || !stub) {
    throw new Error('invalid name or stub')
  }
  var code = `
    ;(function () {
      var root = document.getElementById('${name}');
      if (!root) throw new Error('undefined ${stub} root');
      var view = window.${stub}.entry;
      if (!view) throw new Error('undefined ${stub} view');
      ReactDOM.render(React.createElement(view), root);
    }());
  `.replace(/\n|(\s{2})/g, '')
  var output = path.join(config.$path.target.client, 'launch.js')
  fs.writeFileSync(output, code, 'utf8')
  logger.done('view ::', 'launch code generated')
}
function writeLaunchCode ( config ) { var { name , stub } = config . holder if ( ! name || ! stub ) { throw new Error ( 'invalid name or stub' ) } var code = ` ${ name } ${ stub } ${ stub } ${ stub } ` . replace ( / \n|(\s{2}) / g , '' ) var output = path . join ( config . $path . target . client , 'launch.js' ) fs . writeFileSync ( output , code , 'utf8' ) logger . done ( 'view ::' , 'launch code generated' ) }
write launch code

@param  {Object} config
write launch code