28
28
// can be found here:
29
29
// https://github.com/facebook/create-react-app/blob/v3.4.1/packages/react-dev-utils/webpackHotDevClient.js
30
30
31
+ /// <reference types="webpack/module.d.ts" />
32
+
31
33
import {
32
34
register ,
33
35
onBuildError ,
@@ -67,7 +69,6 @@ import {
67
69
// https://github.com/glenjamin/webpack-hot-middleware
68
70
69
71
declare global {
70
- const __webpack_hash__ : string
71
72
interface Window {
72
73
__nextDevClientId : number
73
74
}
@@ -406,7 +407,6 @@ function isUpdateAvailable() {
406
407
407
408
// Webpack disallows updates in other states.
408
409
function canApplyUpdates ( ) {
409
- // @ts -expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
410
410
return module . hot . status ( ) === 'idle'
411
411
}
412
412
function afterApplyUpdates ( fn : ( ) => void ) {
@@ -415,12 +415,10 @@ function afterApplyUpdates(fn: () => void) {
415
415
} else {
416
416
function handler ( status : string ) {
417
417
if ( status === 'idle' ) {
418
- // @ts -expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
419
418
module . hot . removeStatusHandler ( handler )
420
419
fn ( )
421
420
}
422
421
}
423
- // @ts -expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
424
422
module . hot . addStatusHandler ( handler )
425
423
}
426
424
}
@@ -430,7 +428,6 @@ function tryApplyUpdates(
430
428
onBeforeHotUpdate : ( ( updatedModules : string [ ] ) => unknown ) | undefined ,
431
429
onHotUpdateSuccess : ( updatedModules : string [ ] ) => unknown
432
430
) {
433
- // @ts -expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
434
431
if ( ! module . hot ) {
435
432
// HotModuleReplacementPlugin is not in Webpack configuration.
436
433
console . error ( 'HotModuleReplacementPlugin is not in Webpack configuration.' )
@@ -480,7 +477,6 @@ function tryApplyUpdates(
480
477
}
481
478
482
479
// https://webpack.js.org/api/hot-module-replacement/#check
483
- // @ts -expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
484
480
module . hot
485
481
. check ( /* autoApply */ false )
486
482
. then ( ( updatedModules : any ) => {
@@ -491,7 +487,6 @@ function tryApplyUpdates(
491
487
if ( typeof onBeforeHotUpdate === 'function' ) {
492
488
onBeforeHotUpdate ( updatedModules )
493
489
}
494
- // @ts -expect-error TODO: module.hot exists but type needs to be added. Can't use `as any` here as webpack parses for `module.hot` calls.
495
490
return module . hot . apply ( )
496
491
} )
497
492
. then (
0 commit comments