/g' ./node_modules/snackbarjs/src/snackbar.js`;
- }
- },
+ command: `node ${nodeFlags} src/core/config/scripts/fixSnackBarMarkup.js`,
stdout: false
},
},
diff --git a/src/core/config/scripts/fixCryptoApiImports.js b/src/core/config/scripts/fixCryptoApiImports.js
new file mode 100644
index 0000000000..f4b7c76750
--- /dev/null
+++ b/src/core/config/scripts/fixCryptoApiImports.js
@@ -0,0 +1,54 @@
+/**
+ * This script updates crypto-api package
+ * It adds .mjs to local imports where its missing
+ *
+ * before:
+ * import foo from "./bar";
+ * after
+ * import foo from "./bar.mjs";
+ *
+ */
+
+/* eslint no-console: ["off"] */
+
+import { readdirSync, readFileSync, writeFileSync } from "fs";
+import { join } from "path";
+
+// Base directory of crypto-api source
+const baseDir = join(process.cwd(), "node_modules/crypto-api/src");
+
+/**
+ * Recursively walk a directory, updating import statements
+ * to include ".mjs" if missing
+ */
+function walk(dir) {
+ const entries = readdirSync(dir, { withFileTypes: true });
+
+ for (const entry of entries) {
+ if (entry.name === ".git") continue;
+
+ const fullPath = join(dir, entry.name);
+
+ if (entry.isDirectory()) {
+ walk(fullPath);
+ } else if (entry.isFile()) {
+ const content = readFileSync(fullPath, "utf8");
+
+ // Add .mjs to imports if not present
+ const updated = content.replace(
+ /from "(\.[^"]*)";/g,
+ (match, p1) => {
+ if (p1.endsWith(".mjs")) return match;
+ return `from "${p1}.mjs";`;
+ }
+ );
+
+ if (updated !== content) {
+ writeFileSync(fullPath, updated, "utf8");
+ }
+ }
+ }
+}
+
+// Run the walker
+walk(baseDir);
diff --git a/src/core/config/scripts/fixSnackBarMarkup.js b/src/core/config/scripts/fixSnackBarMarkup.js
new file mode 100644
index 0000000000..eba011ab72
--- /dev/null
+++ b/src/core/config/scripts/fixSnackBarMarkup.js
@@ -0,0 +1,28 @@
+/**
+ * This script updates snackbarjs package
+ * Replaces self-closing div with standard opening div
+ *
+ * before:
+ *
+ * after:
+ *
+ *
+ */
+
+/* eslint no-console: ["off"] */
+
+import { readFileSync, writeFileSync } from "fs";
+import { join } from "path";
+
+// Base directory of snackbarjs source
+const filePath = join(process.cwd(), "node_modules/snackbarjs/src/snackbar.js");
+
+const content = readFileSync(filePath, "utf8");
+
+// Replace self-closing div with standard opening div
+const updated = content.replace(
+ /
/g,
+ "
"
+);
+
+writeFileSync(filePath, updated, "utf8");
From 8ecf83c4da95855341bc2cb81fd63ebdb295ed75 Mon Sep 17 00:00:00 2001
From: BigYellowHammer <6392942+BigYellowHammer@users.noreply.github.com>
Date: Fri, 27 Mar 2026 11:42:17 +0100
Subject: [PATCH 2/2] Renaming to mjs to fix docker build
---
Gruntfile.js | 4 ++--
.../{fixCryptoApiImports.js => fixCryptoApiImports.mjs} | 0
.../scripts/{fixSnackBarMarkup.js => fixSnackBarMarkup.mjs} | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename src/core/config/scripts/{fixCryptoApiImports.js => fixCryptoApiImports.mjs} (100%)
rename src/core/config/scripts/{fixSnackBarMarkup.js => fixSnackBarMarkup.mjs} (100%)
diff --git a/Gruntfile.js b/Gruntfile.js
index c9a21e22c3..b04f30485b 100755
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -411,11 +411,11 @@ module.exports = function (grunt) {
stdout: false,
},
fixCryptoApiImports: {
- command: `node ${nodeFlags} src/core/config/scripts/fixCryptoApiImports.js`,
+ command: `node ${nodeFlags} src/core/config/scripts/fixCryptoApiImports.mjs`,
stdout: false
},
fixSnackbarMarkup: {
- command: `node ${nodeFlags} src/core/config/scripts/fixSnackBarMarkup.js`,
+ command: `node ${nodeFlags} src/core/config/scripts/fixSnackBarMarkup.mjs`,
stdout: false
},
},
diff --git a/src/core/config/scripts/fixCryptoApiImports.js b/src/core/config/scripts/fixCryptoApiImports.mjs
similarity index 100%
rename from src/core/config/scripts/fixCryptoApiImports.js
rename to src/core/config/scripts/fixCryptoApiImports.mjs
diff --git a/src/core/config/scripts/fixSnackBarMarkup.js b/src/core/config/scripts/fixSnackBarMarkup.mjs
similarity index 100%
rename from src/core/config/scripts/fixSnackBarMarkup.js
rename to src/core/config/scripts/fixSnackBarMarkup.mjs