require('excelize-wasm'); throws to the following error:
TypeError: Cannot set property crypto of #<Object> which has only a getter
at Module.<anonymous> (…/node_modules/excelize-wasm/main.cjs:1:46588)
because global.crypto is now a getter without a setter.
Node already has crypto.getRandomValues and performance.now available by default, so this patching is not even needed, i.e. should be skipped if these properties already exist.
Description
excelize-wasm 0.0.4 does not run on Node 20 or later due to following code trying to patch
global.crypto
ifwindow
is undefined: https://github.com/xuri/excelize-wasm/blob/1bcf40777dce377549d407a36bbaf2c9c7098320/src/index.js#L1-L14:require('excelize-wasm');
throws to the following error:because
global.crypto
is now a getter without a setter.Node already has
crypto.getRandomValues
andperformance.now
available by default, so this patching is not even needed, i.e. should be skipped if these properties already exist.Output of
node -v
: v20.11.1Excelize version or commit ID: v0.0.4