-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle absent 'crypto' as per nodejs docs #19100
Comments
Note that one place in the code actually does rely on |
Can you elaborate on what scenarios require node without crypto? |
@mhegazy three scenarios [UPDATED]:
Here's a very relevant piece in node's lib/internal/util.js L100: const noCrypto = !process.versions.openssl;
exports.assertCrypto = function(exports) {
if (noCrypto)
throw new Error('Node.js is not compiled with openssl crypto support');
}; |
We're going to need some sort of hashing mechanism at some point, we should just use that as a fallback for |
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
TypeScript compiler relies on node's 'crypto' module unconditionally:
https://github.com/Microsoft/TypeScript/blob/6997e9b7316b081f8731d131139c7d7f1bba9092/src/compiler/sys.ts#L132
Whereas node's documentation for crypto module explicitly states:
That means on a reduced node environment the compiler crashes unnecessarily. By unnecessarily I mean the support for crypto is already optional in the compiler:
https://github.com/Microsoft/TypeScript/blob/6997e9b7316b081f8731d131139c7d7f1bba9092/src/compiler/sys.ts#L67
https://github.com/Microsoft/TypeScript/blob/d7269f1386bb1ad4351a6f6d5f749e89cb14c2b7/src/compiler/watch.ts#L635
https://github.com/Microsoft/TypeScript/blob/67a6a9477f90d61955f92fb33e7b11491dbd17a5/src/compiler/program.ts#L165
Expected behavior:
TSC to work without 'crypto'
Actual behavior:
TSC fails without 'crypto'
The text was updated successfully, but these errors were encountered: