Enrich plugin JS URLs when SSR'ing apps

This commit is contained in:
Andrew Kingston 2022-10-04 16:28:01 +01:00
parent b148b7d004
commit d5cde049a7
1 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,6 @@
import { Plugin } from "@budibase/types"
import { enrichPluginURLs } from "../../../utilities/plugins"
require("svelte/register") require("svelte/register")
const send = require("koa-send") const send = require("koa-send")
@ -22,6 +25,7 @@ const fs = require("fs")
const { const {
downloadTarballDirect, downloadTarballDirect,
} = require("../../../utilities/fileSystem/utilities") } = require("../../../utilities/fileSystem/utilities")
const { isMultiTenant } = require("@budibase/backend-core/tenancy")
async function prepareUpload({ s3Key, bucket, metadata, file }: any) { async function prepareUpload({ s3Key, bucket, metadata, file }: any) {
const response = await upload({ const response = await upload({
@ -107,12 +111,13 @@ export const serveApp = async function (ctx: any) {
if (!env.isJest()) { if (!env.isJest()) {
const App = require("./templates/BudibaseApp.svelte").default const App = require("./templates/BudibaseApp.svelte").default
const plugins = enrichPluginURLs(appInfo.usedPlugins)
const { head, html, css } = App.render({ const { head, html, css } = App.render({
title: appInfo.name, title: appInfo.name,
production: env.isProd(), production: env.isProd(),
appId, appId,
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx), clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
usedPlugins: appInfo.usedPlugins, usedPlugins: plugins,
}) })
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`) const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`)