fix playground navigation by disabling live-reload for iframed

This commit is contained in:
Cole Lawrence 2022-06-22 14:36:33 -04:00
parent 92921734e9
commit 6dc68d9ae9

View file

@ -34,6 +34,13 @@ export function createEsbuildLiveReloadTools(): {
js: `;(${function liveReloadClientSetup() { js: `;(${function liveReloadClientSetup() {
// from packages/playground/devEnv/createEsbuildLiveReloadTools.ts // from packages/playground/devEnv/createEsbuildLiveReloadTools.ts
function connect() { function connect() {
if (window.parent !== window) {
console.log(
'%cLive reload disabled for iframed content',
'color: gray',
)
return
}
try { try {
const es = new EventSource('/esbuild') const es = new EventSource('/esbuild')
es.onmessage = (evt) => { es.onmessage = (evt) => {