fix: add vite-ignore comment inside dynamic crypto import (#17623)

pull/17628/head
Rich Harris 3 days ago committed by GitHub
parent d7a8e3d130
commit f05f946fea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: add vite-ignore comment inside dynamic crypto import

@ -13,7 +13,7 @@ export async function sha256(data) {
? globalThis.crypto
: // @ts-ignore - we don't install node types in the prod build
// don't use 'node:crypto' because static analysers will think we rely on node when we don't
(await import('node:' + 'crypto')).webcrypto;
(await import(/* @vite-ignore */ 'node:' + 'crypto')).webcrypto;
const hash_buffer = await crypto.subtle.digest('SHA-256', text_encoder.encode(data));

Loading…
Cancel
Save