|
|
const fs = require('fs');
|
|
|
const rp = require('request-promise');
|
|
|
const path = require('path');
|
|
|
const pkg = require('../../package.json');
|
|
|
const {createBundleRenderer} = require('vue-server-renderer');
|
...
|
...
|
@@ -33,13 +34,15 @@ const render = (req, res, next) => { |
|
|
};
|
|
|
|
|
|
if (!isDev) {
|
|
|
const serverBundle = require(`https://cdn.yoho.cn/yohoblk-wap/bundle/yoho-ssr-server-${pkg.version}.json`);
|
|
|
const clientManifest = require(`https://cdn.yoho.cn/yohoblk-wap/bundle/yoho-ssr-client-${pkg.version}.json`);
|
|
|
|
|
|
renderer = createBundleRenderer(serverBundle, {
|
|
|
runInNewContext: false,
|
|
|
template,
|
|
|
clientManifest
|
|
|
Promise.all([
|
|
|
rp(`https://cdn.yoho.cn/yohoblk-wap/bundle/yoho-ssr-server-${pkg.version}.json`, {json: true}),
|
|
|
rp(`https://cdn.yoho.cn/yohoblk-wap/bundle/yoho-ssr-client-${pkg.version}.json`, {json: true}),
|
|
|
]).then(results => {
|
|
|
renderer = createBundleRenderer(results[0], {
|
|
|
runInNewContext: false,
|
|
|
template,
|
|
|
clientManifest: results[1]
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|