Update plugin JS URL handling
This commit is contained in:
parent
4e6f3d44b7
commit
ae38d75be0
|
@ -88,9 +88,7 @@
|
|||
<!-- But before loadBudibase is called -->
|
||||
{#if usedPlugins?.length}
|
||||
{#each usedPlugins as plugin}
|
||||
<script
|
||||
type="application/javascript"
|
||||
src={`/plugins/${plugin.jsUrl}`}></script>
|
||||
<script type="application/javascript" src={plugin.jsUrl}></script>
|
||||
{/each}
|
||||
{/if}
|
||||
<script type="application/javascript">
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
import env from "../environment"
|
||||
import { plugins as ProPlugins } from "@budibase/pro"
|
||||
|
||||
export const enrichPluginURLs = plugins => {
|
||||
if (!plugins || !plugins.length) {
|
||||
return []
|
||||
}
|
||||
return plugins.map(plugin => {
|
||||
const cloud = !env.SELF_HOSTED
|
||||
// In self host we need to prefix the path, as "plugins" is not part of the
|
||||
// bucket path. In cloud, "plugins" is already part of the bucket path.
|
||||
let jsUrl = cloud ? "https://cdn.budi.live/" : "/plugins/"
|
||||
jsUrl += ProPlugins.getBucketPath(plugin.name)
|
||||
jsUrl += "plugin.min.js"
|
||||
return {
|
||||
...plugin,
|
||||
jsUrl,
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue