Skip to content

Commit

Permalink
fix hmr error overlay (#1331)
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott authored Oct 16, 2020
1 parent 8634e43 commit c751555
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions snowpack/assets/hmr-error-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ output itself here.
*/

const ERROR_OVERLAY_TEMPLATE = `
<template id="snowpack-error-overlay">
<style>
:host {
all: initial;
Expand Down Expand Up @@ -886,11 +885,10 @@ const ERROR_OVERLAY_TEMPLATE = `
</p>
<hr><pre>Loading...</pre></div>
</div></div></div></div>
</template>`;
`;

var wrapper = document.createElement('div');
wrapper.innerHTML = ERROR_OVERLAY_TEMPLATE;
document.body.appendChild(wrapper);
const template = document.createElement('template');
template.innerHTML = ERROR_OVERLAY_TEMPLATE;

customElements.define('hmr-error-overlay', class HmrErrorOverlay extends HTMLElement {
constructor({ title, errorMessage, fileLoc, errorStackTrace }) {
Expand All @@ -900,7 +898,6 @@ customElements.define('hmr-error-overlay', class HmrErrorOverlay extends HTMLEle
this.fileLoc = fileLoc;
this.errorStackTrace = errorStackTrace;
this.sr = this.attachShadow({ mode: 'open' });
const template = document.getElementById('snowpack-error-overlay');
this.sr.appendChild(template.content.cloneNode(true));
this.close = this.close.bind(this);
}
Expand Down
2 changes: 1 addition & 1 deletion test-dev/__snapshots__/dev.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`snowpack dev smoke: html 1`] = `
<meta name=\\"description\\" content=\\"Web site created using create-snowpack-app\\" />
<link rel=\\"stylesheet\\" type=\\"text/css\\" href=\\"/index.css\\" />
<title>Snowpack App</title>
<script type=\\"module\\" integrity=\\"sha384-Z1OPSs1KV1TOmQHeoGF8XyUQcMaBnM0p0xip/dmSSpZWySqHrGOuQ5R4sSJgwPrM\\" src=\\"/__snowpack__/hmr-client.js\\"></script><script type=\\"module\\" integrity=\\"sha384-ZHQS30EqaFTVzyH5XP0i+sVAiN0+DiOd1AikxE6LsJbQaA40xjdaXluCLs/7hPlM\\" src=\\"/__snowpack__/hmr-error-overlay.js\\"></script></head>
<script type=\\"module\\" integrity=\\"sha384-Z1OPSs1KV1TOmQHeoGF8XyUQcMaBnM0p0xip/dmSSpZWySqHrGOuQ5R4sSJgwPrM\\" src=\\"/__snowpack__/hmr-client.js\\"></script><script type=\\"module\\" integrity=\\"sha384-LH/mFhEGRB4jHedP0nqOoIUwc4VX8eWJxEL+qTGWtroqiLJ2vxX169J0oSBMHL5o\\" src=\\"/__snowpack__/hmr-error-overlay.js\\"></script></head>
<body>
<img id=\\"img\\" src=\\"/logo.svg\\" />
<canvas id=\\"canvas\\"></canvas>
Expand Down

1 comment on commit c751555

@vercel
Copy link

@vercel vercel bot commented on c751555 Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.