@@ -632,62 +632,13 @@ class HtmlWebpackPlugin {
632632 const templateWithoutLoaders = templateFilename
633633 . replace ( / ^ .+ ! / , "" )
634634 . replace ( / \? .+ $ / , "" ) ;
635- const vmContext = vm . createContext ( {
636- ... global ,
635+ // Not using `...global` as it throws when localStorage is not explicitly enabled in Node 25+
636+ const vmContext = vm . createContext ( Object . assign ( Object . defineProperties ( Object . getOwnPropertyDescriptors ( global ) ) , {
637637 HTML_WEBPACK_PLUGIN : true ,
638- require : require ,
639638 htmlWebpackPluginPublicPath : publicPath ,
640639 __filename : templateWithoutLoaders ,
641640 __dirname : path . dirname ( templateWithoutLoaders ) ,
642- AbortController : global . AbortController ,
643- AbortSignal : global . AbortSignal ,
644- Blob : global . Blob ,
645- Buffer : global . Buffer ,
646- ByteLengthQueuingStrategy : global . ByteLengthQueuingStrategy ,
647- BroadcastChannel : global . BroadcastChannel ,
648- CompressionStream : global . CompressionStream ,
649- CountQueuingStrategy : global . CountQueuingStrategy ,
650- Crypto : global . Crypto ,
651- CryptoKey : global . CryptoKey ,
652- CustomEvent : global . CustomEvent ,
653- DecompressionStream : global . DecompressionStream ,
654- Event : global . Event ,
655- EventTarget : global . EventTarget ,
656- File : global . File ,
657- FormData : global . FormData ,
658- Headers : global . Headers ,
659- MessageChannel : global . MessageChannel ,
660- MessageEvent : global . MessageEvent ,
661- MessagePort : global . MessagePort ,
662- PerformanceEntry : global . PerformanceEntry ,
663- PerformanceMark : global . PerformanceMark ,
664- PerformanceMeasure : global . PerformanceMeasure ,
665- PerformanceObserver : global . PerformanceObserver ,
666- PerformanceObserverEntryList : global . PerformanceObserverEntryList ,
667- PerformanceResourceTiming : global . PerformanceResourceTiming ,
668- ReadableByteStreamController : global . ReadableByteStreamController ,
669- ReadableStream : global . ReadableStream ,
670- ReadableStreamBYOBReader : global . ReadableStreamBYOBReader ,
671- ReadableStreamBYOBRequest : global . ReadableStreamBYOBRequest ,
672- ReadableStreamDefaultController : global . ReadableStreamDefaultController ,
673- ReadableStreamDefaultReader : global . ReadableStreamDefaultReader ,
674- Response : global . Response ,
675- Request : global . Request ,
676- SubtleCrypto : global . SubtleCrypto ,
677- DOMException : global . DOMException ,
678- TextDecoder : global . TextDecoder ,
679- TextDecoderStream : global . TextDecoderStream ,
680- TextEncoder : global . TextEncoder ,
681- TextEncoderStream : global . TextEncoderStream ,
682- TransformStream : global . TransformStream ,
683- TransformStreamDefaultController : global . TransformStreamDefaultController ,
684- URL : global . URL ,
685- URLSearchParams : global . URLSearchParams ,
686- WebAssembly : global . WebAssembly ,
687- WritableStream : global . WritableStream ,
688- WritableStreamDefaultController : global . WritableStreamDefaultController ,
689- WritableStreamDefaultWriter : global . WritableStreamDefaultWriter ,
690- } ) ;
641+ } ) ) ;
691642
692643 const vmScript = new vm . Script ( source , {
693644 filename : templateWithoutLoaders ,
0 commit comments