create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import connect from './error-overlay/hot-dev-client';
import { sendMessage } from './error-overlay/websocket';
export default (()=>{
const devClient = connect();
devClient.subscribeToHmrEvent((obj)=>{
if (obj.action === 'reloadPage') {
sendMessage(JSON.stringify({
event: 'client-reload-page',
clientId: window.__nextDevClientId
}));
return window.location.reload();
}
if (obj.action === 'removedPage') {
const [page] = obj.data;
if (page === window.next.router.pathname) {
sendMessage(JSON.stringify({
event: 'client-removed-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
if (obj.action === 'addedPage') {
const [page] = obj.data;
if (page === window.next.router.pathname && typeof window.next.router.components[page] === 'undefined') {
sendMessage(JSON.stringify({
event: 'client-added-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
throw new Error('Unexpected action ' + obj.action);
});
return devClient;
});
//# sourceMappingURL=webpack-hot-middleware-client.js.map