From 44530c9dbb073bbf6863eda19e55d81eddaa51ac Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 14 Nov 2024 15:59:59 -0800 Subject: [PATCH 1/2] Use publicPath auto for setting public path dynamically. Turn off pathinfo which we deliberately turned off for development, but accidentally left enabled for production, which is not recommended. --- kolibri/core/assets/src/index.js | 5 ----- packages/kolibri-module/src/index.js | 7 ------- packages/kolibri-tools/lib/webpack.config.plugin.js | 3 ++- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/kolibri/core/assets/src/index.js b/kolibri/core/assets/src/index.js index 535b70c71b1..2c313aa6e4c 100644 --- a/kolibri/core/assets/src/index.js +++ b/kolibri/core/assets/src/index.js @@ -14,11 +14,6 @@ import coreModule from './state/modules/core'; // Do this before any async imports to ensure that public paths // are set correctly urls.setUp(); -if (process.env.NODE_ENV === 'production') { - /* eslint-disable no-undef */ - __webpack_public_path__ = urls.static(`${__kolibriModuleName}/`); - /* eslint-enable */ -} // Shim window.location.origin for IE. if (!window.location.origin) { diff --git a/packages/kolibri-module/src/index.js b/packages/kolibri-module/src/index.js index 7408be3a621..58e40eff8fe 100644 --- a/packages/kolibri-module/src/index.js +++ b/packages/kolibri-module/src/index.js @@ -5,13 +5,6 @@ */ import coreApp from 'kolibri'; -import urls from 'kolibri/urls'; - -if (process.env.NODE_ENV === 'production') { - /* eslint-disable no-undef */ - __webpack_public_path__ = urls.static(`${__kolibriModuleName}/`); - /* eslint-enable */ -} export default class KolibriModule { /** diff --git a/packages/kolibri-tools/lib/webpack.config.plugin.js b/packages/kolibri-tools/lib/webpack.config.plugin.js index 2ecfd7a74b2..3bb48174861 100644 --- a/packages/kolibri-tools/lib/webpack.config.plugin.js +++ b/packages/kolibri-tools/lib/webpack.config.plugin.js @@ -117,7 +117,8 @@ module.exports = ( // webpack properly handles that or not. chunkLoadingGlobal: 'webpackChunkwebpack__' + data.name.replace('.', ''), scriptType: 'text/javascript', - pathinfo: mode === 'production', + pathinfo: false, + publicPath: 'auto', }, resolve: { alias, From a82d6dc67b6c8ef3b22ebfaaecb47ab79e39a18b Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 14 Nov 2024 16:00:12 -0800 Subject: [PATCH 2/2] Clean up IE shim that is no longer needed. --- kolibri/core/assets/src/index.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/kolibri/core/assets/src/index.js b/kolibri/core/assets/src/index.js index 2c313aa6e4c..b4819ae111c 100644 --- a/kolibri/core/assets/src/index.js +++ b/kolibri/core/assets/src/index.js @@ -15,13 +15,6 @@ import coreModule from './state/modules/core'; // are set correctly urls.setUp(); -// Shim window.location.origin for IE. -if (!window.location.origin) { - window.location.origin = `${window.location.protocol}//${window.location.hostname}${ - window.location.port ? `:${window.location.port}` : '' - }`; -} - // set up logging logging.setDefaultLevel(process.env.NODE_ENV === 'production' ? 2 : 0);