Skip to content

Commit d4428c6

Browse files
JulienPradetgregberge
authored andcommitted
fix: empty cache on each server reload (#431)
Fixes #230
1 parent f1e75b6 commit d4428c6

File tree

6 files changed

+20
-0
lines changed

6 files changed

+20
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'a'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'b'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'c'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'd'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'e'

packages/server/src/ChunkExtractor.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,21 @@ class ChunkExtractor {
307307
const assets = this.getChunkAssets(entrypoint)
308308
const mainAsset = assets.find(asset => asset.scriptType === 'script')
309309
invariant(mainAsset, 'asset not found')
310+
311+
this.stats.assets
312+
.filter(({ name }) => {
313+
const type = extensionToScriptType(
314+
path
315+
.extname(name)
316+
.split('?')[0]
317+
.toLowerCase(),
318+
)
319+
return type === 'script'
320+
})
321+
.forEach(({ name }) => {
322+
smartRequire(path.join(this.outputPath, name.split('?')[0]))
323+
})
324+
310325
return smartRequire(mainAsset.path)
311326
}
312327

0 commit comments

Comments
 (0)