diff --git a/graal-nodejs/lib/internal/process/pre_execution.js b/graal-nodejs/lib/internal/process/pre_execution.js index 9347c8b1e4a..1e9f3d70bae 100644 --- a/graal-nodejs/lib/internal/process/pre_execution.js +++ b/graal-nodejs/lib/internal/process/pre_execution.js @@ -120,9 +120,26 @@ function prepareExecution(options) { function setupSymbolDisposePolyfill() { // TODO(MoLow): Remove this polyfill once Symbol.dispose and Symbol.asyncDispose are available in V8. // eslint-disable-next-line node-core/prefer-primordials - Symbol.dispose ??= SymbolDispose; + if (typeof Symbol.dispose !== 'symbol') { + ObjectDefineProperty(Symbol, 'dispose', { + __proto__: null, + configurable: false, + enumerable: false, + value: SymbolDispose, + writable: false, + }); + } + // eslint-disable-next-line node-core/prefer-primordials - Symbol.asyncDispose ??= SymbolAsyncDispose; + if (typeof Symbol.asyncDispose !== 'symbol') { + ObjectDefineProperty(Symbol, 'asyncDispose', { + __proto__: null, + configurable: false, + enumerable: false, + value: SymbolAsyncDispose, + writable: false, + }); + } } function setupUserModules(isLoaderWorker = false) {