@@ -5,6 +5,7 @@ import onDemandEntryHandler from './on-demand-entry-handler'
5
5
import webpack from './build/webpack'
6
6
import clean from './build/clean'
7
7
import getConfig from './config'
8
+ import UUID from 'uuid'
8
9
import {
9
10
IS_BUNDLED_PAGE
10
11
} from './utils'
@@ -23,6 +24,11 @@ export default class HotReloader {
23
24
this . prevChunkNames = null
24
25
this . prevFailedChunkNames = null
25
26
this . prevChunkHashes = null
27
+ // Here buildId could be any value.
28
+ // Our router accepts any value in the dev mode.
29
+ // But for the webpack-compiler and for the webpack-dev-server
30
+ // it should be the same value.
31
+ this . buildId = UUID . v4 ( )
26
32
27
33
this . config = getConfig ( dir , conf )
28
34
}
@@ -40,7 +46,7 @@ export default class HotReloader {
40
46
41
47
async start ( ) {
42
48
const [ compiler ] = await Promise . all ( [
43
- webpack ( this . dir , { dev : true , quiet : this . quiet } ) ,
49
+ webpack ( this . dir , { buildId : this . buildId , dev : true , quiet : this . quiet } ) ,
44
50
clean ( this . dir )
45
51
] )
46
52
@@ -66,7 +72,7 @@ export default class HotReloader {
66
72
this . stats = null
67
73
68
74
const [ compiler ] = await Promise . all ( [
69
- webpack ( this . dir , { dev : true , quiet : this . quiet } ) ,
75
+ webpack ( this . dir , { buildId : this . buildId , dev : true , quiet : this . quiet } ) ,
70
76
clean ( this . dir )
71
77
] )
72
78
@@ -173,7 +179,7 @@ export default class HotReloader {
173
179
]
174
180
175
181
let webpackDevMiddlewareConfig = {
176
- publicPath : ' /_next/webpack/' ,
182
+ publicPath : ` /_next/${ this . buildId } / webpack/` ,
177
183
noInfo : true ,
178
184
quiet : true ,
179
185
clientLogLevel : 'warning' ,
0 commit comments