Skip to content

A platform for community discussion. Free, open, simple.

DEV: Update backtrace parsing for new theme compiler (#33894)

David Taylor7fc4e8f4bf2e
diff --git a/app/assets/javascripts/discourse/app/lib/source-identifier.js b/app/assets/javascripts/discourse/app/lib/source-identifier.js
index 3554a00bce8..88cd4d3495a 100644
--- a/app/assets/javascripts/discourse/app/lib/source-identifier.js
+++ b/app/assets/javascripts/discourse/app/lib/source-identifier.js
@@ -37,7 +37,9 @@ export default function identifySource(error) {
const themeMatches = stack.match(/\/theme-javascripts\/[\w-]+\.js/g) || [];
for (const match of themeMatches) {
- const scriptElement = document.querySelector(`script[src*="${match}"`);
+ const scriptElement = document.querySelector(
+ `script[src*="${match}"], link[rel="modulepreload"][href*="${match}"]`
+ );
if (scriptElement?.dataset.themeId) {
return {
type: "theme",