Skip to content

Commit 38bff2a

Browse files
committed
fix(server): fix chunk cache issue
1 parent ef47ae1 commit 38bff2a

File tree

1 file changed

+13
-0
lines changed
  • packages/smooth-core/src/server

1 file changed

+13
-0
lines changed

packages/smooth-core/src/server/ssr.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ function enhanceApp(options = {}, App) {
1212
return options.enhanceApp ? options.enhanceApp(App) : App
1313
}
1414

15+
function clearCache() {
16+
const keys = Object.keys(require.cache)
17+
keys.forEach(key => {
18+
if (key.match(/node\/static\//)) {
19+
delete require.cache[key]
20+
}
21+
})
22+
}
23+
1524
export default function ssrMiddleware({
1625
config,
1726
schema,
@@ -29,6 +38,10 @@ export default function ssrMiddleware({
2938
'web/static/loadable-stats.json',
3039
)
3140

41+
if (config.env !== 'production') {
42+
clearCache()
43+
}
44+
3245
const nodeExtractor = new ChunkExtractor({
3346
statsFile: nodeStats,
3447
outputPath: path.join(config.cachePath, 'node/static'),

0 commit comments

Comments
 (0)