Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,33 @@ const chunkResolvers: Map<ChunkUrl, ChunkResolver> = new Map()
return resolver.promise
}

if (sourceType === SourceType.Runtime && isCss(chunkUrl)) {
if (sourceType === SourceType.Runtime) {
// CSS chunks do not register themselves, and as such must be marked as
// loaded instantly.
resolver.loadingStarted = true
resolver.resolve()
return resolver.promise

if (isCss(chunkUrl)) {
resolver.resolve()
return resolver.promise
}
Comment thread
fireairforce marked this conversation as resolved.

// Runtime JS chunks are expected to be present in the DOM already.
// Load it first
if (typeof importScripts !== 'function') {
const decodedChunkUrl = decodeURI(chunkUrl)
const previousScripts = document.querySelectorAll(
`script[src="${chunkUrl}"],script[src^="${chunkUrl}?"],script[src="${decodedChunkUrl}"],script[src^="${decodedChunkUrl}?"]`
)
Comment thread
fireairforce marked this conversation as resolved.
if (previousScripts.length > 0) {
for (const script of Array.from(previousScripts)) {
script.addEventListener('error', () => {
resolver.reject()
})
}
return resolver.promise
}
Comment thread
fireairforce marked this conversation as resolved.
}
// If it wasn't present in the DOM, fallback to loading logic.
}

if (typeof importScripts === 'function') {
Expand Down
Loading