Update plugin JS URL handling
This commit is contained in:
parent
4e6f3d44b7
commit
ae38d75be0
|
@ -88,9 +88,7 @@
|
||||||
<!-- But before loadBudibase is called -->
|
<!-- But before loadBudibase is called -->
|
||||||
{#if usedPlugins?.length}
|
{#if usedPlugins?.length}
|
||||||
{#each usedPlugins as plugin}
|
{#each usedPlugins as plugin}
|
||||||
<script
|
<script type="application/javascript" src={plugin.jsUrl}></script>
|
||||||
type="application/javascript"
|
|
||||||
src={`/plugins/${plugin.jsUrl}`}></script>
|
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
<script type="application/javascript">
|
<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