feat: expose backend url in admin options (#7370)

This commit is contained in:
Oli Juhl
2024-05-20 11:24:15 +02:00
committed by GitHub
parent 028f63eb63
commit c9bffdfecb
3 changed files with 8 additions and 7 deletions

View File

@@ -17,6 +17,8 @@ export async function getViteConfig(
const root = path.resolve(__dirname, "./")
const backendUrl = options.backendUrl ?? ""
return {
root: path.resolve(__dirname, "./"),
base: options.path,
@@ -29,12 +31,7 @@ export async function getViteConfig(
},
define: {
__BASE__: JSON.stringify(options.path),
/**
* TODO: Accept backend url from config to support hosting the admin elsewhere.
* The empty string should be the default value, as that ensures that requests
* are made to the server that serves the admin dashboard.
*/
__BACKEND_URL__: JSON.stringify(""),
__BACKEND_URL__: JSON.stringify(backendUrl),
},
server: {
open: true,

View File

@@ -1,4 +1,4 @@
import { AdminOptions } from "@medusajs/types"
export type BundlerOptions = Required<Pick<AdminOptions, "outDir" | "path">> &
Pick<AdminOptions, "vite">
Pick<AdminOptions, "vite" | "backendUrl">