const baseUrl = process.env.SB_SERVER ? process.env.SB_SERVER : process.webpackEnv.SB_SERVER

// Returns an absolute server URL for a path, if necessary (if running in Electron). If it's not
// necessary (in the browser), the path will be returned unmodified
export function makeServerUrl(path) {
  if (!IS_ELECTRON) {
    return path
  }

  const slashedPath = (path.length === 0 || path.startsWith('/') ? '' : '/') + path
  return baseUrl + slashedPath
}

const baseUrl = process?.env?.SB_SERVER ? process.env.SB_SERVER : process.webpackEnv.SB_SERVER

// Returns an absolute server URL for a path, if necessary (if running in Electron). If it's not
// necessary (in the browser), the path will be returned unmodified
export function makeServerUrl(path) {
  if (!IS_ELECTRON) {
    return path
  }

  const slashedPath = (path.length === 0 || path.startsWith('/') ? '' : '/') + path
  return baseUrl + slashedPath
}

Use process.env more safely with Webpack 5.
Use process.env more safely with Webpack 5.
