Second frontend, written in Next.JS + Typescript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
31 KiB

{"ast":null,"code":"\"use strict\";\n\nvar _regeneratorRuntime = require(\"@babel/runtime/regenerator\");\n\nvar _slicedToArray = require(\"@babel/runtime/helpers/slicedToArray\");\n\nvar _interopRequireWildcard = require(\"@babel/runtime/helpers/interopRequireWildcard\");\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\");\n\nexports.__esModule = true;\nexports[\"default\"] = connect;\n\nvar _eventsource = require(\"./eventsource\");\n\nvar _formatWebpackMessages = _interopRequireDefault(require(\"./format-webpack-messages\"));\n\nvar ErrorOverlay = _interopRequireWildcard(require(\"next/dist/compiled/react-error-overlay\"));\n\nvar _stripAnsi = _interopRequireDefault(require(\"next/dist/compiled/strip-ansi\"));\n\nvar _sourceMapSupport = require(\"./source-map-support\");\n\nvar _unfetch = _interopRequireDefault(require(\"next/dist/build/polyfills/unfetch\"));\n/* eslint-disable camelcase */\n\n/**\nMIT License\nCopyright (c) 2013-present, Facebook, Inc.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n// This file is based on https://github.com/facebook/create-react-app/blob/v1.1.4/packages/react-dev-utils/webpackHotDevClient.js\n// It's been edited to rely on webpack-hot-middleware and to be more compatible with SSR / Next.js\n// This alternative WebpackDevServer combines the functionality of:\n// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js\n// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js\n// It only supports their simplest configuration (hot updates on same server).\n// It makes some opinionated choices on top, like adding a syntax error overlay\n// that looks similar to our console output. The error overlay is inspired by:\n// https://github.com/glenjamin/webpack-hot-middleware\n// This is a modified version of create-react-app's webpackHotDevClient.js\n// It implements webpack-hot-middleware's EventSource events instead of webpack-dev-server's websocket.\n// https://github.com/facebook/create-react-app/blob/25184c4e91ebabd16fe1cde3d8630830e4a36a01/packages/react-dev-utils/webpackHotDevClient.js\n\n\nvar hadRuntimeError = false;\nvar customHmrEventHandler;\n\nfunction connect(options) {\n // Open stack traces in an editor.\n ErrorOverlay.setEditorHandler(function editorHandler(_ref) {\n var fileName = _ref.fileName,\n lineNumber = _ref.lineNumber,\n colNumber = _ref.colNumber; // Resolve invalid paths coming from react-error-overlay\n\n var resolvedFilename = fileName.replace(/^webpack:\\/\\//, '');\n (0, _unfetch[\"default\"])('/_next/development/open-stack-frame-in-editor' + (\"?fileName=\" + window.encodeURIComponent(resolvedFilename)) + (\"&lineNumber=\" + (lineNumber || 1)) + (\"&colNumber=\" + (colNumber || 1)));\n }); // We need to keep track of if there has been a runtime error.\n // Essentially, we cannot guarantee application state was not corrupted by the\n // runtime error. To prevent confusing behavior, we forcibly reload the entire\n // application. This is handled below when we are notified of a compile (code\n // change).\n // See https://github.com/facebook/create-react-app/issues/3096\n\n ErrorOverlay.startReportingRuntimeErrors({\n onError: function onError() {\n hadRuntimeError = true;\n }\n });\n\n if (module.hot && typeof module.hot.dispose === 'function') {\n module.hot.dispose(function () {\n // TODO: why do we need this?\n ErrorOverlay.stopReportingRuntimeErrors();\n });\n }\n\n (0, _eventsource.getEventSourceWrapper)(options).addMessageListener(function (event) {\n // This is the heartbeat event\n if (event.data === \"\\uD83D\\uDC93\") {\n return;\n }\n\n try {\n processMessage(event);\n } catch (ex) {\n console.warn('Invalid HMR message: ' + event.data + '\\n' + ex);\n }\n });\n return {\n subscribeToHmrEvent: function subscribeToHmrEvent(handler) {\n customHmrEventHandler = handler;\n },\n reportRuntimeError: function reportRuntimeError(err) {\n ErrorOverlay.reportRuntimeError(err);\n },\n prepareError: function prepareError(err) {\n // Temporary workaround for https://github.com/facebook/create-react-app/issues/4760\n // Should be removed once the fix lands\n hadRuntimeError = true; // react-error-overlay expects a type of `Error`\n\n var error = new Error(err.message);\n error.name = err.name;\n error.stack = err.stack; // __NEXT_DIST_DIR is provided by webpack\n\n (0, _sourceMapSupport.rewriteStacktrace)(error, process.env.__NEXT_DIST_DIR);\n return error;\n }\n };\n} // Remember some state related to hot module replacement.\n\n\nvar isFirstCompilation = true;\nvar mostRecentCompilationHash = null;\nvar hasCompileErrors = false;\nvar deferredBuildError = null;\n\nfunction clearOutdatedErrors() {\n // Clean up outdated compile errors, if any.\n if (typeof console !== 'undefined' && typeof console.clear === 'function') {\n if (hasCompileErrors) {\n console.clear();\n }\n }\n\n deferredBuildError = null;\n} // Successful compilation.\n\n\nfunction handleSuccess() {\n var isHotUpdate = !isFirstCompilation;\n isFirstCompilation = false;\n hasCompileErrors = false; // Attempt to apply hot updates or reload.\n\n if (isHotUpdate) {\n tryApplyUpdates(function onHotUpdateSuccess() {\n if (deferredBuildError) {\n deferredBuildError();\n } else {\n // Only dismiss it when we're sure it's a hot update.\n // Otherwise it would flicker right before the reload.\n ErrorOverlay.dismissBuildError();\n }\n });\n }\n} // Compilation with warnings (e.g. ESLint).\n\n\nfunction handleWarnings(warnings) {\n clearOutdatedErrors(); // Print warnings to the console.\n\n var formatted = (0, _formatWebpackMessages[\"default\"])({\n warnings: warnings,\n errors: []\n });\n\n if (typeof console !== 'undefined' && typeof console.warn === 'function') {\n for (var i = 0; i < formatted.warnings.length; i++) {\n if (i === 5) {\n console.warn('There were more warnings in other files.\\n' + 'You can find a complete log in the terminal.');\n break;\n }\n\n console.warn((0, _stripAnsi[\"default\"])(formatted.warnings[i]));\n }\n }\n} // Compilation with errors (e.g. syntax error or missing modules).\n\n\nfunction handleErrors(errors) {\n clearOutdatedErrors();\n isFirstCompilation = false;\n hasCompileErrors = true; // \"Massage\" webpack messages.\n\n var formatted = (0, _formatWebpackMessages[\"default\"])({\n errors: errors,\n warnings: []\n }); // Only show the first error.\n\n ErrorOverlay.reportBuildError(formatted.errors[0]); // Also log them to the console.\n\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n for (var i = 0; i < formatted.errors.length; i++) {\n console.error((0, _stripAnsi[\"default\"])(formatted.errors[i]));\n }\n }\n} // There is a newer version of the code available.\n\n\nfunction handleAvailableHash(hash) {\n // Update last known compilation hash.\n mostRecentCompilationHash = hash;\n} // Handle messages from the server.\n\n\nfunction processMessage(e) {\n var obj = JSON.parse(e.data);\n\n switch (obj.action) {\n case 'building':\n {\n console.log('[HMR] bundle ' + (obj.name ? \"'\" + obj.name + \"' \" : '') + 'rebuilding');\n break;\n }\n\n case 'built':\n case 'sync':\n {\n clearOutdatedErrors();\n\n if (obj.hash) {\n handleAvailableHash(obj.hash);\n }\n\n var errors = obj.errors,\n warnings = obj.warnings;\n var hasErrors = Boolean(errors && errors.length);\n var hasWarnings = Boolean(warnings && warnings.length);\n\n if (hasErrors) {\n // When there is a compilation error coming from SSR we have to reload the page on next successful compile\n if (obj.action === 'sync') {\n hadRuntimeError = true;\n }\n\n handleErrors(errors);\n break;\n } else if (hasWarnings) {\n handleWarnings(warnings);\n }\n\n handleSuccess();\n break;\n }\n\n case 'typeChecked':\n {\n var _obj$data = _slicedToArray(obj.data, 1),\n _obj$data$ = _obj$data[0],\n _errors = _obj$data$.errors,\n _warnings = _obj$data$.warnings;\n\n var _hasErrors = Boolean(_errors && _errors.length);\n\n var _hasWarnings = Boolean(_warnings && _warnings.length);\n\n if (_hasErrors) {\n if (canApplyUpdates()) {\n handleErrors(_errors);\n } else {\n deferredBuildError = function deferredBuildError() {\n return handleErrors(_errors);\n };\n }\n } else if (_hasWarnings) {\n handleWarnings(_warnings);\n }\n\n break;\n }\n\n default:\n {\n if (customHmrEventHandler) {\n customHmrEventHandler(obj);\n break;\n }\n\n break;\n }\n }\n} // Is there a newer version of this code available?\n\n\nfunction isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_hash__;\n} // Webpack disallows updates in other states.\n\n\nfunction canApplyUpdates() {\n return module.hot.status() === 'idle';\n} // Attempt to update code on the fly, fall back to a hard reload.\n\n\nfunction tryApplyUpdates(onHotUpdateSuccess) {\n var handleApplyUpdates, updatedModules;\n return _regeneratorRuntime.async(function tryApplyUpdates$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n handleApplyUpdates = function _handleApplyUpdates(err, updatedModules) {\n if (err || hadRuntimeError) {\n if (err) {\n console.warn('Error while applying updates, reloading page', err);\n }\n\n if (hadRuntimeError) {\n console.warn('Had runtime error previously, reloading page');\n }\n\n window.location.reload();\n return;\n }\n\n if (typeof onHotUpdateSuccess === 'function') {\n // Maybe we want to do something.\n onHotUpdateSuccess();\n }\n\n if (isUpdateAvailable()) {\n // While we were updating, there was a new update! Do it again.\n tryApplyUpdates();\n }\n };\n\n if (module.hot) {\n _context.next = 4;\n break;\n }\n\n // HotModuleReplacementPlugin is not in Webpack configuration.\n console.error('HotModuleReplacementPlugin is not in Webpack configuration.'); // window.location.reload();\n\n return _context.abrupt(\"return\");\n\n case 4:\n if (!(!isUpdateAvailable() || !canApplyUpdates())) {\n _context.next = 7;\n break;\n }\n\n ErrorOverlay.dismissBuildError();\n return _context.abrupt(\"return\");\n\n case 7:\n _context.prev = 7;\n _context.next = 10;\n return _regeneratorRuntime.awrap(module.hot.check(\n /* autoApply */\n {\n ignoreUnaccepted: true\n }));\n\n case 10:\n updatedModules = _context.sent;\n\n if (updatedModules) {\n handleApplyUpdates(null, updatedModules);\n }\n\n _context.next = 17;\n break;\n\n case 14:\n _context.prev = 14;\n _context.t0 = _context[\"catch\"](7);\n handleApplyUpdates(_context.t0, null);\n\n case 17:\n case \"end\":\n return _context.stop();\n }\n }\n }, null, null, [[7, 14]], Promise);\n}","map":{"version":3,"sources":["/data/projects/react/rpdata-frontend2/node_modules/next/dist/client/dev/error-overlay/hot-dev-client.js"],"names":["_interopRequireWildcard","require","_interopRequireDefault","exports","__esModule","connect","_eventsource","_formatWebpackMessages","ErrorOverlay","_stripAnsi","_sourceMapSupport","_unfetch","hadRuntimeError","customHmrEventHandler","options","setEditorHandler","editorHandler","_ref","fileName","lineNumber","colNumber","resolvedFilename","replace","window","encodeURIComponent","startReportingRuntimeErrors","onError","module","hot","dispose","stopReportingRuntimeErrors","getEventSourceWrapper","addMessageListener","event","data","processMessage","ex","console","warn","subscribeToHmrEvent","handler","reportRuntimeError","err","prepareError","error","Error","message","name","stack","rewriteStacktrace","process","env","__NEXT_DIST_DIR","isFirstCompilation","mostRecentCompilationHash","hasCompileErrors","deferredBuildError","clearOutdatedErrors","clear","handleSuccess","isHotUpdate","tryApplyUpdates","onHotUpdateSuccess","dismissBuildError","handleWarnings","warnings","formatted","errors","i","length","handleErrors","reportBuildError","handleAvailableHash","hash","e","obj","JSON","parse","action","log","hasErrors","Boolean","hasWarnings","_errors","_warnings","_hasErrors","_hasWarnings","canApplyUpdates","isUpdateAvailable","__webpack_hash__","status","handleApplyUpdates","updatedModules","location","reload","check","ignoreUnaccepted"],"mappings":"AAAA;;;;;;AAAa,IAAIA,uBAAuB,GAACC,OAAO,CAAC,+CAAD,CAAnC;;AAAqF,IAAIC,sBAAsB,GAACD,OAAO,CAAC,8CAAD,CAAlC;;AAAmFE,OAAO,CAACC,U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kE;;AAAA,kBAAG9B,eAAH,EAAmB;AAACyB,gBAAAA,OAAO,CAACC,IAAR,CAAa,8CAAb;AAA8D;;AAAAf,cAAAA,MAAM,CAACsE,QAAP,CAAgBC,MAAhB;AAAyB;AAAQ;;AAAA,gBAAG,OAAOhC,kBAAP,KAA4B,UAA/B,EAA0C;AAAC;AAC/YA,cAAAA,kBAAkB;AAAI;;AAAA,gBAAG0B,iBAAiB,EAApB,EAAuB;AAAC;AAC9C3B,cAAAA,eAAe;AAAI;AAAC,WAJpB;;AAAA,cAAuDlC,MAAM,CAACC,GAA9D;AAAA;AAAA;AAAA;;AAAmE;AACnES,UAAAA,OAAO,CAACO,KAAR,CAAc,6DAAd,EADA,CAC6E;;AAD7E;;AAAA;AAAA,gBAEW,CAAC4C,iBAAiB,EAAlB,IAAsB,CAACD,eAAe,EAFjD;AAAA;AAAA;AAAA;;AAEqD/E,UAAAA,YAAY,CAACuD,iBAAb;AAFrD;;AAAA;AAAA;AAAA;AAAA,2CAK6BpC,MAAM,CAACC,GAAP,CAAWmE,KAAX;AAAiB;AAAe;AAACC,YAAAA,gBAAgB,EAAC;AAAlB,WAAhC,CAL7B;;AAAA;AAKQJ,UAAAA,cALR;;AAKsF,cAAGA,cAAH,EAAkB;AAACD,YAAAA,kBAAkB,CAAC,IAAD,EAAMC,cAAN,CAAlB;AAAyC;;AALlJ;AAAA;;AAAA;AAAA;AAAA;AAK8JD,UAAAA,kBAAkB,cAAK,IAAL,CAAlB;;AAL9J;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["\"use strict\";var _interopRequireWildcard=require(\"@babel/runtime/helpers/interopRequireWildcard\");var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");exports.__esModule=true;exports.default=connect;var _eventsource=require(\"./eventsource\");var _formatWebpackMessages=_interopRequireDefault(require(\"./format-webpack-messages\"));var ErrorOverlay=_interopRequireWildcard(require(\"next/dist/compiled/react-error-overlay\"));var _stripAnsi=_interopRequireDefault(require(\"next/dist/compiled/strip-ansi\"));var _sourceMapSupport=require(\"./source-map-support\");var _unfetch=_interopRequireDefault(require(\"next/dist/build/polyfills/unfetch\"));/* eslint-disable camelcase */ /**\nMIT License\n\nCopyright (c) 2013-present, Facebook, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/ // This file is based on https://github.com/facebook/create-react-app/blob/v1.1.4/packages/react-dev-utils/webpackHotDevClient.js\n// It's been edited to rely on webpack-hot-middleware and to be more compatible with SSR / Next.js\n// This alternative WebpackDevServer combines the functionality of:\n// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js\n// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js\n// It only supports their simplest configuration (hot updates on same server).\n// It makes some opinionated choices on top, like adding a syntax error overlay\n// that looks similar to our console output. The error overlay is inspired by:\n// https://github.com/glenjamin/webpack-hot-middleware\n// This is a modified version of create-react-app's webpackHotDevClient.js\n// It implements webpack-hot-middleware's EventSource events instead of webpack-dev-server's websocket.\n// https://github.com/facebook/create-react-app/blob/25184c4e91ebabd16fe1cde3d8630830e4a36a01/packages/react-dev-utils/webpackHotDevClient.js\nvar hadRuntimeError=false;var customHmrEventHandler;function connect(options){// Open stack traces in an editor.\nErrorOverlay.setEditorHandler(function editorHandler(_ref){var{fileName,lineNumber,colNumber}=_ref;// Resolve invalid paths coming from react-error-overlay\nvar resolvedFilename=fileName.replace(/^webpack:\\/\\//,'');(0,_unfetch.default)('/_next/development/open-stack-frame-in-editor'+(\"?fileName=\"+window.encodeURIComponent(resolvedFilename))+(\"&lineNumber=\"+(lineNumber||1))+(\"&colNumber=\"+(colNumber||1)));});// We need to keep track of if there has been a runtime error.\n// Essentially, we cannot guarantee application state was not corrupted by the\n// runtime error. To prevent confusing behavior, we forcibly reload the entire\n// application. This is handled below when we are notified of a compile (code\n// change).\n// See https://github.com/facebook/create-react-app/issues/3096\nErrorOverlay.startReportingRuntimeErrors({onError:function onError(){hadRuntimeError=true;}});if(module.hot&&typeof module.hot.dispose==='function'){module.hot.dispose(function(){// TODO: why do we need this?\nErrorOverlay.stopReportingRuntimeErrors();});}(0,_eventsource.getEventSourceWrapper)(options).addMessageListener(event=>{// This is the heartbeat event\nif(event.data==='\\uD83D\\uDC93'){return;}try{processMessage(event);}catch(ex){console.warn('Invalid HMR message: '+event.data+'\\n'+ex);}});return{subscribeToHmrEvent(handler){customHmrEventHandler=handler;},reportRuntimeError(err){ErrorOverlay.reportRuntimeError(err);},prepareError(err){// Temporary workaround for https://github.com/facebook/create-react-app/issues/4760\n// Should be removed once the fix lands\nhadRuntimeError=true;// react-error-overlay expects a type of `Error`\nvar error=new Error(err.message);error.name=err.name;error.stack=err.stack;// __NEXT_DIST_DIR is provided by webpack\n(0,_sourceMapSupport.rewriteStacktrace)(error,process.env.__NEXT_DIST_DIR);return error;}};}// Remember some state related to hot module replacement.\nvar isFirstCompilation=true;var mostRecentCompilationHash=null;var hasCompileErrors=false;var deferredBuildError=null;function clearOutdatedErrors(){// Clean up outdated compile errors, if any.\nif(typeof console!=='undefined'&&typeof console.clear==='function'){if(hasCompileErrors){console.clear();}}deferredBuildError=null;}// Successful compilation.\nfunction handleSuccess(){var isHotUpdate=!isFirstCompilation;isFirstCompilation=false;hasCompileErrors=false;// Attempt to apply hot updates or reload.\nif(isHotUpdate){tryApplyUpdates(function onHotUpdateSuccess(){if(deferredBuildError){deferredBuildError();}else{// Only dismiss it when we're sure it's a hot update.\n// Otherwise it would flicker right before the reload.\nErrorOverlay.dismissBuildError();}});}}// Compilation with warnings (e.g. ESLint).\nfunction handleWarnings(warnings){clearOutdatedErrors();// Print warnings to the console.\nvar formatted=(0,_formatWebpackMessages.default)({warnings:warnings,errors:[]});if(typeof console!=='undefined'&&typeof console.warn==='function'){for(var i=0;i<formatted.warnings.length;i++){if(i===5){console.warn('There were more warnings in other files.\\n'+'You can find a complete log in the terminal.');break;}console.warn((0,_stripAnsi.default)(formatted.warnings[i]));}}}// Compilation with errors (e.g. syntax error or missing modules).\nfunction handleErrors(errors){clearOutdatedErrors();isFirstCompilation=false;hasCompileErrors=true;// \"Massage\" webpack messages.\nvar formatted=(0,_formatWebpackMessages.default)({errors:errors,warnings:[]});// Only show the first error.\nErrorOverlay.reportBuildError(formatted.errors[0]);// Also log them to the console.\nif(typeof console!=='undefined'&&typeof console.error==='function'){for(var i=0;i<formatted.errors.length;i++){console.error((0,_stripAnsi.default)(formatted.errors[i]));}}}// There is a newer version of the code available.\nfunction handleAvailableHash(hash){// Update last known compilation hash.\nmostRecentCompilationHash=hash;}// Handle messages from the server.\nfunction processMessage(e){var obj=JSON.parse(e.data);switch(obj.action){case'building':{console.log('[HMR] bundle '+(obj.name?\"'\"+obj.name+\"' \":'')+'rebuilding');break;}case'built':case'sync':{clearOutdatedErrors();if(obj.hash){handleAvailableHash(obj.hash);}var{errors,warnings}=obj;var hasErrors=Boolean(errors&&errors.length);var hasWarnings=Boolean(warnings&&warnings.length);if(hasErrors){// When there is a compilation error coming from SSR we have to reload the page on next successful compile\nif(obj.action==='sync'){hadRuntimeError=true;}handleErrors(errors);break;}else if(hasWarnings){handleWarnings(warnings);}handleSuccess();break;}case'typeChecked':{var[{errors:_errors,warnings:_warnings}]=obj.data;var _hasErrors=Boolean(_errors&&_errors.length);var _hasWarnings=Boolean(_warnings&&_warnings.length);if(_hasErrors){if(canApplyUpdates()){handleErrors(_errors);}else{deferredBuildError=()=>handleErrors(_errors);}}else if(_hasWarnings){handleWarnings(_warnings);}break;}default:{if(customHmrEventHandler){customHmrEventHandler(obj);break;}break;}}}// Is there a newer version of this code available?\nfunction isUpdateAvailable(){/* globals __webpack_hash__ */ // __webpack_hash__ is the hash of the current compilation.\n// It's a global variable injected by Webpack.\nreturn mostRecentCompilationHash!==__webpack_hash__;}// Webpack disallows updates in other states.\nfunction canApplyUpdates(){return module.hot.status()==='idle';}// Attempt to update code on the fly, fall back to a hard reload.\nasync function tryApplyUpdates(onHotUpdateSuccess){if(!module.hot){// HotModuleReplacementPlugin is not in Webpack configuration.\nconsole.error('HotModuleReplacementPlugin is not in Webpack configuration.');// window.location.reload();\nreturn;}if(!isUpdateAvailable()||!canApplyUpdates()){ErrorOverlay.dismissBuildError();return;}function handleApplyUpdates(err,updatedModules){if(err||hadRuntimeError){if(err){console.warn('Error while applying updates, reloading page',err);}if(hadRuntimeError){console.warn('Had runtime error previously, reloading page');}window.location.reload();return;}if(typeof onHotUpdateSuccess==='function'){// Maybe we want to do something.\nonHotUpdateSuccess();}if(isUpdateAvailable()){// While we were updating, there was a new update! Do it again.\ntryApplyUpdates();}}// https://webpack.github.io/docs/hot-module-replacement.html#check\ntry{var updatedModules=await module.hot.check(/* autoApply */{ignoreUnaccepted:true});if(updatedModules){handleApplyUpdates(null,updatedModules);}}catch(err){handleApplyUpdates(err,null);}}"]},"metadata":{},"sourceType":"script"}