diff --git a/app/assets/javascripts/bootstrap-json/index.js b/app/assets/javascripts/bootstrap-json/index.js index 6936c330383..f4aee92f832 100644 --- a/app/assets/javascripts/bootstrap-json/index.js +++ b/app/assets/javascripts/bootstrap-json/index.js @@ -44,10 +44,28 @@ function updateScriptReferences({ } } - const newElements = chunks.map( - (chunk) => - `` - ); + const newElements = chunks.map((chunk) => { + let newElement = `<${element.tagName}`; + + for (const [attr, value] of element.attributes) { + if (attr === attribute) { + newElement += ` ${attribute}="${baseURL}${chunk}"`; + } else if (value === "") { + newElement += ` ${attr}`; + } else { + newElement += ` ${attr}="${value}"`; + } + } + + newElement += ` data-ember-cli-rewritten="true"`; + newElement += `>`; + + if (element.tagName === "script") { + newElement += ``; + } + + return newElement; + }); if ( entrypointName === "discourse" &&