fix(medusa,admin-ui): Remove forced backendUrl in development, and allow alternative host value. (#7128)

This commit is contained in:
Kasper Fabricius Kristensen
2024-04-24 09:50:59 +02:00
committed by GitHub
parent 10e120062b
commit 40686ba980
4 changed files with 27 additions and 11 deletions
+13 -7
View File
@@ -22,10 +22,11 @@ export async function develop({
backend: "http://localhost:9000",
develop: {
open: true,
host: "localhost",
port: 7001,
logLevel: "error",
stats: "normal",
allowedHosts: 'auto',
allowedHosts: "auto",
},
},
}: DevelopArgs) {
@@ -54,13 +55,16 @@ export async function develop({
const devServerArgs: DevServerConfiguration = {
port: options.develop.port,
host: options.develop.host,
client: {
logging: "none",
overlay: {
errors: true,
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,
onListening: options.develop.open
@@ -70,7 +74,7 @@ export async function develop({
}
openBrowser(
`http://localhost:${options.develop.port}${
`http://${options.develop.host}:${options.develop.port}${
options.path ? options.path : ""
}`
)
@@ -85,16 +89,18 @@ export async function develop({
disableDotRule: 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 runServer = async () => {
logger.info(
`Started development server on http://localhost:${options.develop.port}${
options.path ? options.path : ""
}`
`Started development server on http://${options.develop.host}:${
options.develop.port
}${options.path ? options.path : ""}`
)
await server.start()
+7 -1
View File
@@ -17,6 +17,12 @@ export type DevelopOptions = {
* @default true
*/
open?: boolean
/**
* The host the development server should run on.
*
* @default "localhost"
*/
host?: string
/**
* The port the development server should run on.
* @default 7001
@@ -40,7 +46,7 @@ export type DevelopOptions = {
/**
* Specifying URL to web socket server
*/
webSocketURL?: string | WebSocketURL |undefined
webSocketURL?: string | WebSocketURL | undefined
}
export type AdminOptions = {