alibaba / alibaba/rax-map

Uncaught TypeError: Cannot read property 'crypto' of undefined in object-hash

Open
#5 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
108
Forks
25
PR merge metrics
No merged PRs in 30d

Description

import { Map } from 'rax-map';

引入rax-map后,项目报错,如下

object_hash.js?b83a:1 Uncaught TypeError: Cannot read property 'crypto' of undefined
at eval (object_hash.js?b83a:1)
at Object.eval (object_hash.js?b83a:1)
at Object.7.buffer (object_hash.js?b83a:1)
at o (object_hash.js?b83a:1)
at eval (object_hash.js?b83a:1)
at Object.eval (object_hash.js?b83a:1)
at Object.5../md5 (object_hash.js?b83a:1)
at o (object_hash.js?b83a:1)
at eval (object_hash.js?b83a:1)
at Object.eval (object_hash.js?b83a:1)

/api/components/markers中依赖了object-hash,但是这个库依赖了node.js的crypto模块,在browser环境跑不起来会报错呀

https://github.com/alibaba/rax-map/blob/dev/0.0.10/api/components/markers/index.js#L12

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with api/components/markers/index.js at the object-hash dependency referenced in the issue, then reproduce the import in a browser environment. Trace why object-hash accesses Node.js crypto and verify that importing rax-map no longer produces the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.