lost dependencies
hainuo opened this issue · comments
- Have you checked the guidelines in our Contributing document?
Description
when i used locutus in my reactnative project ,i got error
import {base64_decode,time} from 'locutus';
unable to resolve module cry pto from /path/to/node_modules/locutus/php/strings/md5.js:unable to find this module map or any of the node_modules directories under /path/to /node_modules/crypto and its parent directories
also i found out the fs path module which also needed by locutus
The import seems wrong, there is a language level and a category/module level under which the functions are nested. Seems like perhaps you are importing more than you bargained for, seeing as how it's complaining about md5 and you intend to just use two other functions.
Also not sure how you are bundling? If you did intend on using md5 would rely on the crypto module of node, so you'd need browserling substitutes for that perhaps. Although with React Native I feel a bit out of my comfort zone, I do believe it's not a node, but rather a browser platform correct?
i just used like npm install locutus
in my project
i see, but the php/strings/md5.js contain one line require('crypto')
in line 17, so i don't think it'll runing in other web plan,if who user md5 funtion by require ('php/strings/md5') or import {md5} from 'locutus'.
Although I did not use the MD5 method, but the react-native environment for me to do a check。so i think someone should add the dependices into package.json for people used it
Ah crypo, vs crypto, that seems a bug, let me check
my mistake , i'll fixed it(convert to right word)
Hm no, it seems to use crypto
which is correct:
var crypto = require('crypto')
crypto is a node module, not sure how we could ship it
i used command 'npm install crypto' but not enough,i'll try in a single html just use md5.js to test that crypto module is done
@LiuXuFei It's possible that in cleaning up the codebase, a regression was introduced. The original library was taken from here https://sourceforge.net/projects/bcmath-js/ and saved here https://github.com/kvz/locutus/blob/master/src/php/_helpers/_bc.js, making it standardjs compatible. Then, https://github.com/kvz/locutus/blob/master/src/php/bc/bcmul.js uses this library. Maybe you can spot an error? If all else fails, I'd recommend to keep using the pre-locutus 1.3.2 version for now.