Skip to content

Commit

Permalink
Move the unhomoglyph data to its own file (#26095)
Browse files Browse the repository at this point in the history
This solves problems wherein the javascript debugger would get confused and
show the execution point two lines away from the source.
  • Loading branch information
richvdh committed Sep 1, 2023
1 parent bff5b6e commit 0080395
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/vector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,16 @@
<body style="height: 100%; margin: 0;">
<noscript>Sorry, Element requires JavaScript to be enabled.</noscript> <!-- TODO: Translate this? -->
<section id="matrixchat" style="height: 100%;" class="notranslate"></section>
<script src="<%= htmlWebpackPlugin.files.js.find(entry => entry.includes("bundle.js")) %>"></script>

<%
// insert <script> tags for the JS entry points
for (let file of htmlWebpackPlugin.files.js) {
if (file.includes("bundle.js") || file.includes("unhomoglyph_data")) {
%> <script src="<%= file %>"></script>
<%
}
}
%>

<!-- Legacy supporting Prefetch images -->
<img src="<%= require('matrix-react-sdk/res/img/warning.svg').default %>" aria-hidden alt="" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
Expand Down
11 changes: 11 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ module.exports = (env, argv) => {
enforce: true,
// Do not add `chunks: 'all'` here because you'll break the app entry point.
},

// put the unhomoglyph data in its own file. It contains
// magic characters which mess up line numbers in the
// javascript debugger.
unhomoglyph_data: {
name: "unhomoglyph_data",
test: /unhomoglyph\/data\.json$/,
enforce: true,
chunks: "all",
},

default: {
reuseExistingChunk: true,
},
Expand Down

0 comments on commit 0080395

Please sign in to comment.