Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpeiris committed Feb 16, 2022
1 parent a68c28e commit f35028a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/utils/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ let isAdmin = false;
const el = document.querySelector(`meta[name='env:${x.toLowerCase()}']`);
configs[x] = el ? el.getAttribute("content") : process.env[x];

if (x === "BASE_ASSETS_PATH" && configs["BASE_ASSETS_PATH"]) {
// eslint-disable-next-line no-undef
__webpack_public_path__ = configs["BASE_ASSETS_PATH"];

const BASE_ASSETS_PATH_KEY = "BASE_ASSETS_PATH";
if (x === BASE_ASSETS_PATH_KEY && configs[BASE_ASSETS_PATH_KEY]) {
// BASE_ASSETS_PATH might be a relative URL like "/" when it is set in
// .env or .defaults.env when running locally. We need to convert that
// to an absolute URL.
if (configs["BASE_ASSETS_PATH"] && !configs["BASE_ASSETS_PATH"].startsWith("http")) {
configs["BASE_ASSETS_PATH"] = new URL(configs["BASE_ASSETS_PATH"], window.location);
if (!configs[BASE_ASSETS_PATH_KEY].startsWith("http")) {
configs[BASE_ASSETS_PATH_KEY] = new URL(configs[BASE_ASSETS_PATH_KEY], window.location).toString();
}

// eslint-disable-next-line no-undef
__webpack_public_path__ = configs[BASE_ASSETS_PATH_KEY];
}
});

Expand Down

0 comments on commit f35028a

Please sign in to comment.