vue/benchmarks/ssr/renderToString.js

20 lines
598 B
JavaScript
Raw Normal View History

'use strict'
2017-03-17 12:09:12 +08:00
process.env.NODE_ENV = 'production'
2016-11-17 05:41:44 +08:00
const Vue = require('../../dist/vue.runtime.common.js')
2016-06-25 12:05:39 +08:00
const createRenderer = require('../../packages/vue-server-renderer').createRenderer
const renderToString = createRenderer().renderToString
const gridComponent = require('./common.js')
console.log('--- renderToString --- ')
const self = (global || root)
self.s = self.performance.now()
2017-05-14 14:23:38 +08:00
renderToString(new Vue(gridComponent), (err, res) => {
if (err) throw err
// console.log(res)
console.log('Complete time: ' + (self.performance.now() - self.s).toFixed(2) + 'ms')
console.log()
})