From 517af8fe66e498f0434029e2ee93af061bfbf6ea Mon Sep 17 00:00:00 2001 From: Matt Vague Date: Thu, 14 Apr 2022 18:09:30 -0700 Subject: [PATCH] Patch missing TextEncoder/TextDecoder --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index d2046e3..a4767f9 100644 --- a/src/index.js +++ b/src/index.js @@ -187,6 +187,10 @@ async function prerender (parentCompilation, request, options, inject, loader) { window.requestAnimationFrame = () => ++counter; window.cancelAnimationFrame = () => { }; + // Patch window.TextEncoder/window.TextDecoder (which are now standard in modern browsers) with node implementations + window.TextEncoder = require('util').TextEncoder + window.TextDecoder = require('util').TextDecoder + // Never prerender Custom Elements: by skipping registration, we get only the Light DOM which is desirable. window.customElements = { define () {},