mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-26 00:38:01 +00:00
fix: add browser to mainFields resolution to prevent crypto-browserify bundling
ws package has a browser field pointing to a crypto-free entry point. Without 'browser' in mainFields, Vite resolved the Node.js version which pulled in crypto-browserify -> inherits -> runtime error.
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
// Minimal crypto shim that delegates to the browser's native Web Crypto API
|
||||
// Prevents crypto-browserify (and its inherits dependency) from being bundled
|
||||
export default globalThis.crypto;
|
||||
export const webcrypto = globalThis.crypto;
|
||||
export const randomBytes = (size: number): Uint8Array => {
|
||||
const bytes = new Uint8Array(size);
|
||||
globalThis.crypto.getRandomValues(bytes);
|
||||
return bytes;
|
||||
};
|
||||
export const createHash = undefined;
|
||||
export const createHmac = undefined;
|
||||
Reference in New Issue
Block a user