Skip to content

Commit b5780b8

Browse files
fix: handle duplicated root entries in manifest (#14237) (#14244)
Duplicated root entry in manifest happens when running application in development mode but after a frontend build. This change removes the entry potentially added by flow if compile-time manifest already added it Co-authored-by: Marco Collovati <marco@vaadin.com>
1 parent 2c44d33 commit b5780b8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • flow-server/src/main/resources/com/vaadin/flow/server/frontend

‎flow-server/src/main/resources/com/vaadin/flow/server/frontend/sw.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ declare var VITE_ENABLED: boolean; // defined by Webpack/Vite
2121
// Combine manifest entries injected at compile-time by Webpack/Vite
2222
// with ones that Flow injects at runtime through `sw-runtime-resources-precache.js`.
2323
let manifestEntries: PrecacheEntry[] = self.__WB_MANIFEST || [];
24+
// If injected entries contains element for root, then discard the one from Flow
25+
// may only happen when running in development mode, but after a frontend build
26+
let hasRootEntry = manifestEntries.findIndex((entry) => entry.url === '.') >= 0;
2427
if (self.additionalManifestEntries?.length) {
25-
manifestEntries.push(...self.additionalManifestEntries);
28+
manifestEntries.push(...self.additionalManifestEntries.filter( (entry) => entry.url !== '.' || !hasRootEntry));
2629
}
2730

2831
const offlinePath = OFFLINE_PATH;

0 commit comments

Comments
 (0)