Skip to content

Commit

Permalink
fix(hydrate): prevent dead code elimination of patch dom implementati…
Browse files Browse the repository at this point in the history
…on (#4966)
  • Loading branch information
sean-perkins committed Nov 15, 2023
1 parent 62ccd9d commit 5e36057
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hydrate/runner/patch-dom-implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function patchDomImplementation(doc: any, opts: d.HydrateFactoryOptions)
}

try {
doc.baseURI;
// Assigning the baseURI prevents JavaScript optimizers from treating this as dead code
win.__stencil_baseURI = doc.baseURI;
} catch (e) {
Object.defineProperty(doc, 'baseURI', {
get() {
Expand Down

0 comments on commit 5e36057

Please sign in to comment.