Files
todo-frontend/node_modules/@dcloudio/uni-h5-vite/lib/ssr/cloudfunction.js
Agent d12eea7693
Some checks failed
continuous-integration/drone/push Build is failing
fix: 微信登录补充保存username和role
2026-04-04 07:35:21 +00:00

26 lines
765 B
JavaScript

'use strict'
const fs = require('fs')
const path = require('path')
const template = fs.readFileSync(
path.join(__dirname, './server/index.html'),
'utf-8'
)
const manifest = require('./server/ssr-manifest.json')
const render = require('./server/entry-server.js').render
exports.main = async (event) => {
const [appHtml, preloadLinks, appContext] = await render(event.path, manifest)
const html = template
.replace(`<!--preload-links-->`, preloadLinks)
.replace(`<!--app-html-->`, appHtml)
.replace(`<!--app-context-->`, appContext)
return {
mpserverlessComposedResponse: true, // 使用阿里云返回集成响应是需要此字段为true
statusCode: 200,
headers: {
'content-type': 'text/html',
},
body: html,
}
}