(chunk: OutputChunk | OutputAsset | undefined)
| 1013 | const dynamicImports = new Set<string>() |
| 1014 | |
| 1015 | function collect(chunk: OutputChunk | OutputAsset | undefined) { |
| 1016 | if (!chunk || chunk.type !== 'chunk' || collected.has(chunk)) return |
| 1017 | collected.add(chunk) |
| 1018 | |
| 1019 | // First collect all styles from the synchronous imports (lowest priority) |
| 1020 | chunk.imports.forEach((importName) => collect(bundle[importName])) |
| 1021 | // Save dynamic imports in deterministic order to add the styles later (to have the highest priority) |
| 1022 | chunk.dynamicImports.forEach((importName) => |
| 1023 | dynamicImports.add(importName), |
| 1024 | ) |
| 1025 | // Then collect the styles of the current chunk (might overwrite some styles from previous imports) |
| 1026 | extractedCss += chunkCSSMap.get(chunk.preliminaryFileName) ?? '' |
| 1027 | } |
| 1028 | |
| 1029 | // The bundle is guaranteed to be deterministic, if not then we have a bug in rollup. |
| 1030 | // So we use it to ensure a deterministic order of styles |
no test coverage detected