fix(frontend): unbreak dashboard — bundle order, IIFE close, dup const
Three merge-fallout bugs that combined to leave the services grid empty
and most UI inert:
1. error-handler.js was bundled into onboarding.js (loaded 3rd), but
globals.js in core.js (loaded 1st) does `const errorHandler = new
ErrorHandler()` at top level. ErrorHandler was undefined when core.js
ran -> ReferenceError -> globals.js stopped, so window.APPS,
_showTotpOverlay, loadServices, etc. were never set, and init.js
blew up on every call into core's exports.
Moved error-handler.js to the start of the core.js bundle so the
class is on window before any other script touches it.
2. setup-wizard.js also declared `const errorHandler = new ErrorHandler()`
at top level. Classic scripts share the document's top-level lexical
environment, so this collided with globals.js's declaration ->
redeclaration SyntaxError in features.js. Removed setup-wizard.js's
copy; it picks up the global one.
3. tooltip-definitions.js closed its `(function(window){...})(window);`
IIFE at line ~171 ("Validation module loaded"), then the TOOLTIP_
DEFINITIONS array, getter helpers, window.TooltipDefinitions export,
and final `debug(...)` log all sat at top level — outside the IIFE,
where `debug` was no longer in scope. Removed the early close and
added one at EOF so the whole file is in one IIFE.
This commit is contained in:
+6
-1
@@ -11,6 +11,10 @@ const SW_JS = path.join(__dirname, 'sw.js');
|
||||
// Bundle definitions — files are concatenated in order, then minified
|
||||
const bundles = {
|
||||
'core.js': [
|
||||
// error-handler.js MUST be first — globals.js below does
|
||||
// `const errorHandler = new ErrorHandler()` at top level, which throws
|
||||
// ReferenceError if the ErrorHandler class isn't already on `window`.
|
||||
JS('error-handler.js'),
|
||||
JS('globals.js'),
|
||||
JS('skeleton-loader.js'),
|
||||
JS('theme.js'),
|
||||
@@ -57,7 +61,8 @@ const bundles = {
|
||||
],
|
||||
'onboarding.js': [
|
||||
JS('driver.min.js'),
|
||||
JS('error-handler.js'),
|
||||
// error-handler.js moved to core.js bundle; window.ErrorHandler is already
|
||||
// set before this bundle runs.
|
||||
JS('progress-tracker.js'),
|
||||
JS('theme-adapter.js'),
|
||||
JS('tooltip-definitions.js'),
|
||||
|
||||
Reference in New Issue
Block a user