Greenheart / pagecrypt

Password Protected Single Page Applications and HTML files
GNU Affero General Public License v3.0
233 stars 25 forks source link

Error using `pagecrypt` with Node 19 #34

Closed metonym closed 1 year ago

metonym commented 1 year ago

Ref: https://github.com/render-examples/pagecrypt/issues/1

Node version 19 was released last week, and there appears to be a difference in how the loadCrypto function is evaluated.

In Node 16, for example, this condition is not evaluated and crypto is loaded dynamically. However, in Node 19, it appears that the condition is evaluated, producing the ReferenceError: window is not defined message. I'm unsure if this is a bug in Node 19 or if it's an intentional breaking change.

This is the output when running the CLI using Node 19:

file:///Users/pagecrypt/cli.js:16
const crypto2 = window.crypto || globalThis.crypto;
                    ^
ReferenceError: window is not defined
Greenheart commented 1 year ago

@metonym This fix is now available in pagecrypt 6.0.0 :)

metonym commented 1 year ago

Awesome, thanks!