Skip to content

Commit

Permalink
fix(server): ignore *.hot-update.js
Browse files Browse the repository at this point in the history
Closes #148
  • Loading branch information
gregberge committed Nov 20, 2018
1 parent ec95e15 commit edcd2c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/server/__fixtures__/stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
],
"assets": [
"main.css",
"main.js"
"main.js",
"main.hot-update.js"
],
"children": {
"preload": [
Expand Down
10 changes: 8 additions & 2 deletions packages/server/src/ChunkExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ function joinTags(tags) {
return tags.join('\n')
}

const HOT_UPDATE_REGEXP = /\.hot-update\.js$/

function isValidChunkAsset(chunkAsset) {
return chunkAsset.scriptType && !HOT_UPDATE_REGEXP.test(chunkAsset.filename)
}

class ChunkExtractor {
constructor({ statsFile, stats, entrypoints = ['main'], outputPath } = []) {
this.stats = stats || smartRequire(statsFile)
Expand Down Expand Up @@ -120,7 +126,7 @@ class ChunkExtractor {
linkType: 'preload',
}),
)
.filter(chunkAsset => chunkAsset.scriptType)
.filter(isValidChunkAsset)
}

if (Array.isArray(chunks)) {
Expand All @@ -143,7 +149,7 @@ class ChunkExtractor {
linkType: type,
}),
)
.filter(chunkAsset => chunkAsset.scriptType)
.filter(isValidChunkAsset)
}

if (Array.isArray(chunks)) {
Expand Down

0 comments on commit edcd2c8

Please sign in to comment.