feat(dashboard,admin-vite-plugin): Add product zones and fix zone change effect (#7427)
**What** - Adds injection zones to the product domain. - Fixes an issue where changing the `zone` in a widget config to another valid widget would not trigger a HMR event. - Fixes an issue where UI Routes would not work in production.
This commit is contained in:
@@ -1,26 +1,33 @@
|
||||
import inject from "@medusajs/admin-vite-plugin"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { defineConfig } from "vite"
|
||||
|
||||
const BASE = "/"
|
||||
const BACKEND_URL = "http://localhost:9000"
|
||||
|
||||
console.log(inject)
|
||||
import { defineConfig, loadEnv } from "vite"
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react(),
|
||||
inject({
|
||||
debug: true,
|
||||
sources: ["/Users/kasperkristensen/work/v2-server/src/admin"],
|
||||
}),
|
||||
],
|
||||
define: {
|
||||
__BASE__: JSON.stringify(BASE),
|
||||
__BACKEND_URL__: JSON.stringify(BACKEND_URL),
|
||||
},
|
||||
server: {
|
||||
open: true,
|
||||
},
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
|
||||
const BASE = env.VITE_MEDUSA_BASE || "/"
|
||||
const BACKEND_URL = env.VITE_MEDUSA_BACKEND_URL || "http://localhost:9000"
|
||||
|
||||
/**
|
||||
* Add this to your .env file to specify the project to load admin extensions from.
|
||||
*/
|
||||
const MEDUSA_PROJECT = env.VITE_MEDUSA_PROJECT || null
|
||||
const sources = MEDUSA_PROJECT ? [MEDUSA_PROJECT] : []
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
react(),
|
||||
inject({
|
||||
sources,
|
||||
}),
|
||||
],
|
||||
define: {
|
||||
__BASE__: JSON.stringify(BASE),
|
||||
__BACKEND_URL__: JSON.stringify(BACKEND_URL),
|
||||
},
|
||||
server: {
|
||||
open: true,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user