diff --git a/platform/app/.webpack/webpack.pwa.js b/platform/app/.webpack/webpack.pwa.js index 2bbfbc916f3..b8a78d65622 100644 --- a/platform/app/.webpack/webpack.pwa.js +++ b/platform/app/.webpack/webpack.pwa.js @@ -16,7 +16,6 @@ const DIST_DIR = path.join(__dirname, '../dist'); const PUBLIC_DIR = path.join(__dirname, '../public'); // ~~ Env Vars const HTML_TEMPLATE = process.env.HTML_TEMPLATE || 'index.html'; -const PUBLIC_URL = process.env.PUBLIC_URL || '/'; const APP_CONFIG = process.env.APP_CONFIG || 'config/default.js'; // proxy settings @@ -64,7 +63,7 @@ module.exports = (env, argv) => { output: { path: DIST_DIR, filename: isProdBuild ? '[name].bundle.[chunkhash].js' : '[name].js', - publicPath: PUBLIC_URL, // Used by HtmlWebPackPlugin for asset prefix + publicPath: '', devtoolModuleFilenameTemplate: function (info) { if (isProdBuild) { return `webpack:///${info.resourcePath}`; @@ -124,7 +123,7 @@ module.exports = (env, argv) => { template: `${PUBLIC_DIR}/html-templates/${HTML_TEMPLATE}`, filename: 'index.html', templateParameters: { - PUBLIC_URL: PUBLIC_URL, + PUBLIC_URL: '', }, }), // Generate a service worker for fast local loads @@ -174,7 +173,7 @@ module.exports = (env, argv) => { //writeToDisk: true, historyApiFallback: { disableDotRule: true, - index: PUBLIC_URL + 'index.html', + index: 'index.html', }, devMiddleware: { writeToDisk: true, diff --git a/platform/app/.webpack/writePluginImportsFile.js b/platform/app/.webpack/writePluginImportsFile.js index ba00dacf6d6..821b35dfab1 100644 --- a/platform/app/.webpack/writePluginImportsFile.js +++ b/platform/app/.webpack/writePluginImportsFile.js @@ -2,16 +2,15 @@ const pluginConfig = require('../pluginConfig.json'); const fs = require('fs'); const os = require('os'); -const autogenerationDisclaimer = ` +const autogenerationDisclaimer = `import { getPublicSubPath } from '@ohif/core'; + // THIS FILE IS AUTOGENERATED AS PART OF THE EXTENSION AND MODE PLUGIN PROCESS. // IT SHOULD NOT BE MODIFIED MANUALLY \n`; const extractName = val => (typeof val === 'string' ? val : val.packageName); -const publicURL = process.env.PUBLIC_URL || '/'; - function isAbsolutePath(path) { - return path.startsWith('http') || path.startsWith('/'); + return path.startsWith('http'); } function constructLines(input, categoryName) { @@ -66,6 +65,11 @@ function getRuntimeLoadModesExtensions(modules) { const dynamicLoad = []; dynamicLoad.push( '\n\n// Add a dynamic runtime loader', + 'function getRuntimeImportPath(path) {', + " if (typeof path !== 'string' || path.startsWith('http')) return path;", + ' return getPublicSubPath(path);', + '}', + '', 'async function loadModule(module) {', " if (typeof module !== 'string') return module;" ); @@ -77,7 +81,7 @@ function getRuntimeLoadModesExtensions(modules) { if (module.importPath) { dynamicLoad.push( ` if( module==="${packageName}") {`, - ` const imported = await window.browserImportFunction('${isAbsolutePath(module.importPath) ? '' : publicURL}${module.importPath}');`, + ` const imported = await window.browserImportFunction(getRuntimeImportPath('${module.importPath}'));`, ' return ' + (module.globalName ? `window["${module.globalName}"];` diff --git a/platform/app/public/html-templates/index.html b/platform/app/public/html-templates/index.html index ed767921770..8b2f242b65d 100644 --- a/platform/app/public/html-templates/index.html +++ b/platform/app/public/html-templates/index.html @@ -34,6 +34,87 @@ name="msapplication-TileColor" content="#fff" /> + - diff --git a/platform/app/public/html-templates/rollbar.html b/platform/app/public/html-templates/rollbar.html index e385678109d..9e26b1d6c67 100644 --- a/platform/app/public/html-templates/rollbar.html +++ b/platform/app/public/html-templates/rollbar.html @@ -34,6 +34,86 @@ name="msapplication-TileColor" content="#fff" /> + - -