Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Ensure ASSET_BASE_PATH is set before sentry is loaded

Oliver Güntherf4f6f23315c4
diff --git a/frontend/src/app/init-globals.ts b/frontend/src/app/init-globals.ts
index 2c3e39fdc15..371886607f9 100644
--- a/frontend/src/app/init-globals.ts
+++ b/frontend/src/app/init-globals.ts
@@ -26,15 +26,8 @@
// See docs/COPYRIGHT.rdoc for more details.
// ++
-import {whenDebugging} from 'core-app/helpers/debug_output';
-import {enableReactiveStatesLogging} from "reactivestates";
import 'hammerjs';
-// Ensure we set the correct dynamic frontend path
-// based on the RAILS_RELATIVE_URL_ROOT setting
-// https://webpack.js.org/guides/public-path/
-const ASSET_BASE_PATH = '/assets/frontend/';
-
// Global scripts previously part of the application.js
// Avoid require.context since that crashes angular regularly
require('./globals/augmenting/modal-wrapper.augment.service');
@@ -42,22 +35,3 @@ require('./globals/dynamic-bootstrapper');
require('./globals/global-listeners');
require('./globals/openproject');
require('./globals/tree-menu');
-
-// Sets the relative base path
-window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || '';
-
-// Ensure to set the asset base for dynamic code loading
-// https://webpack.js.org/guides/public-path/
-__webpack_public_path__ = window.appBasePath + ASSET_BASE_PATH;
-
-const meta = jQuery('meta[name=openproject_initializer]');
-I18n.locale = meta.data('defaultLocale');
-I18n.locale = meta.data('locale');
-I18n.firstDayOfWeek = parseInt(meta.data('firstDayOfWeek'), 10);
-
-// Enable debug logging for reactive states
-whenDebugging(() => {
- (window as any).enableReactiveStatesLogging = () => enableReactiveStatesLogging(true);
- (window as any).disableReactiveStatesLogging = () => enableReactiveStatesLogging(false);
-});
-
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index a320a0c1bc5..b60011a5190 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -3,22 +3,44 @@ import {enableProdMode} from '@angular/core';
import * as jQuery from "jquery";
import {environment} from './environments/environment';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
+import {SentryReporter} from "core-app/sentry/sentry-reporter";
+import {whenDebugging} from "core-app/helpers/debug_output";
+import {enableReactiveStatesLogging} from "reactivestates";
(window as any).global = window;
+// Ensure we set the correct dynamic frontend path
+// based on the RAILS_RELATIVE_URL_ROOT setting
+// https://webpack.js.org/guides/public-path/
+const ASSET_BASE_PATH = '/assets/frontend/';
+
+// Sets the relative base path
+window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || '';
+
+// Ensure to set the asset base for dynamic code loading
+// https://webpack.js.org/guides/public-path/
+__webpack_public_path__ = window.appBasePath + ASSET_BASE_PATH;
-/** Load sentry integration as soon as possible */
-import {SentryReporter} from "core-app/sentry/sentry-reporter";
window.ErrorReporter = new SentryReporter();
require('core-app/init-vendors');
require('./app/init-globals');
+const meta = jQuery('meta[name=openproject_initializer]');
+I18n.locale = meta.data('defaultLocale');
+I18n.locale = meta.data('locale');
+I18n.firstDayOfWeek = parseInt(meta.data('firstDayOfWeek'), 10);
if (environment.production) {
enableProdMode();
}
+// Enable debug logging for reactive states
+whenDebugging(() => {
+ (window as any).enableReactiveStatesLogging = () => enableReactiveStatesLogging(true);
+ (window as any).disableReactiveStatesLogging = () => enableReactiveStatesLogging(false);
+});
+
jQuery(function () {
// Due to the behaviour of the Edge browser we need to wait for 'DOM ready'
@@ -28,4 +50,3 @@ jQuery(function () {
jQuery('body').addClass('__ng2-bootstrap-has-run');
});
});
-