Skip to content

Commit

Permalink
Update webpack.pwa.js
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudberenbaum authored Oct 13, 2024
1 parent 250c4c4 commit c70ee88
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion platform/app/.webpack/webpack.pwa.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const PUBLIC_URL = process.env.PUBLIC_URL || '/';
const APP_CONFIG = process.env.APP_CONFIG || 'config/default.js';
const PROXY_TARGET = process.env.PROXY_TARGET;
const PROXY_DOMAIN = process.env.PROXY_DOMAIN;
const PROXY_PATH_REWRITE_FROM = process.env.PROXY_PATH_REWRITE_FROM;
const PROXY_PATH_REWRITE_TO = process.env.PROXY_PATH_REWRITE_TO;
const OHIF_PORT = Number(process.env.OHIF_PORT || 3000);
const ENTRY_TARGET = process.env.ENTRY_TARGET || `${SRC_DIR}/index.js`;
const Dotenv = require('dotenv-webpack');
Expand Down Expand Up @@ -184,7 +186,15 @@ module.exports = (env, argv) => {

if (hasProxy) {
mergedConfig.devServer.proxy = mergedConfig.devServer.proxy || {};
mergedConfig.devServer.proxy[PROXY_TARGET] = PROXY_DOMAIN;
mergedConfig.devServer.proxy = {
[PROXY_TARGET]: {
target: PROXY_DOMAIN,
changeOrigin: true,
pathRewrite: {
[`^${PROXY_PATH_REWRITE_FROM}`]: PROXY_PATH_REWRITE_TO,
},
},
};
}

if (isProdBuild) {
Expand Down

0 comments on commit c70ee88

Please sign in to comment.