fix(medusa,admin-ui): Remove forced backendUrl in development, and allow alternative host value. (#7128)
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/admin-ui": patch
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(medusa,admin-ui): Remove forced `backendUrl` from develop command. Allow specifying an alternative host value
|
||||||
@@ -22,10 +22,11 @@ export async function develop({
|
|||||||
backend: "http://localhost:9000",
|
backend: "http://localhost:9000",
|
||||||
develop: {
|
develop: {
|
||||||
open: true,
|
open: true,
|
||||||
|
host: "localhost",
|
||||||
port: 7001,
|
port: 7001,
|
||||||
logLevel: "error",
|
logLevel: "error",
|
||||||
stats: "normal",
|
stats: "normal",
|
||||||
allowedHosts: 'auto',
|
allowedHosts: "auto",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}: DevelopArgs) {
|
}: DevelopArgs) {
|
||||||
@@ -54,13 +55,16 @@ export async function develop({
|
|||||||
|
|
||||||
const devServerArgs: DevServerConfiguration = {
|
const devServerArgs: DevServerConfiguration = {
|
||||||
port: options.develop.port,
|
port: options.develop.port,
|
||||||
|
host: options.develop.host,
|
||||||
client: {
|
client: {
|
||||||
logging: "none",
|
logging: "none",
|
||||||
overlay: {
|
overlay: {
|
||||||
errors: true,
|
errors: true,
|
||||||
warnings: false,
|
warnings: false,
|
||||||
},
|
},
|
||||||
webSocketURL: options.develop.webSocketURL ? options.develop.webSocketURL : `ws://localhost:${options.develop.port}/ws`,
|
webSocketURL: options.develop.webSocketURL
|
||||||
|
? options.develop.webSocketURL
|
||||||
|
: `ws://${options.develop.host}:${options.develop.port}/ws`,
|
||||||
},
|
},
|
||||||
open: false,
|
open: false,
|
||||||
onListening: options.develop.open
|
onListening: options.develop.open
|
||||||
@@ -70,7 +74,7 @@ export async function develop({
|
|||||||
}
|
}
|
||||||
|
|
||||||
openBrowser(
|
openBrowser(
|
||||||
`http://localhost:${options.develop.port}${
|
`http://${options.develop.host}:${options.develop.port}${
|
||||||
options.path ? options.path : ""
|
options.path ? options.path : ""
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
@@ -85,16 +89,18 @@ export async function develop({
|
|||||||
disableDotRule: true,
|
disableDotRule: true,
|
||||||
},
|
},
|
||||||
hot: true,
|
hot: true,
|
||||||
allowedHosts: options.develop.allowedHosts ? options.develop.allowedHosts : 'auto',
|
allowedHosts: options.develop.allowedHosts
|
||||||
|
? options.develop.allowedHosts
|
||||||
|
: "auto",
|
||||||
}
|
}
|
||||||
|
|
||||||
const server = new WebpackDevDerver(devServerArgs, compiler)
|
const server = new WebpackDevDerver(devServerArgs, compiler)
|
||||||
|
|
||||||
const runServer = async () => {
|
const runServer = async () => {
|
||||||
logger.info(
|
logger.info(
|
||||||
`Started development server on http://localhost:${options.develop.port}${
|
`Started development server on http://${options.develop.host}:${
|
||||||
options.path ? options.path : ""
|
options.develop.port
|
||||||
}`
|
}${options.path ? options.path : ""}`
|
||||||
)
|
)
|
||||||
|
|
||||||
await server.start()
|
await server.start()
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ export type DevelopOptions = {
|
|||||||
* @default true
|
* @default true
|
||||||
*/
|
*/
|
||||||
open?: boolean
|
open?: boolean
|
||||||
|
/**
|
||||||
|
* The host the development server should run on.
|
||||||
|
*
|
||||||
|
* @default "localhost"
|
||||||
|
*/
|
||||||
|
host?: string
|
||||||
/**
|
/**
|
||||||
* The port the development server should run on.
|
* The port the development server should run on.
|
||||||
* @default 7001
|
* @default 7001
|
||||||
@@ -40,7 +46,7 @@ export type DevelopOptions = {
|
|||||||
/**
|
/**
|
||||||
* Specifying URL to web socket server
|
* Specifying URL to web socket server
|
||||||
*/
|
*/
|
||||||
webSocketURL?: string | WebSocketURL |undefined
|
webSocketURL?: string | WebSocketURL | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AdminOptions = {
|
export type AdminOptions = {
|
||||||
|
|||||||
@@ -76,9 +76,7 @@ export default async function ({ port, directory }) {
|
|||||||
const { cli, binExists } = resolveAdminCLI()
|
const { cli, binExists } = resolveAdminCLI()
|
||||||
|
|
||||||
if (binExists) {
|
if (binExists) {
|
||||||
const backendUrl = `http://localhost:${port}`
|
const adminChild = fork(cli, [`develop`], {
|
||||||
|
|
||||||
const adminChild = fork(cli, [`develop`, "--backend", `${backendUrl}`], {
|
|
||||||
cwd: directory,
|
cwd: directory,
|
||||||
env: process.env,
|
env: process.env,
|
||||||
stdio: ["pipe", process.stdout, process.stderr, "ipc"],
|
stdio: ["pipe", process.stdout, process.stderr, "ipc"],
|
||||||
|
|||||||
Reference in New Issue
Block a user