lovell / farmhash

Node.js implementation of FarmHash, Google's family of high performance hash functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

browserify farmhash failed with unexpected char

hoogw opened this issue · comments

commented

I try to browserify winnow.js,
But I get error:

I know that farmhash.node have node extension, browserify will failed with .node extension,
I try use browserify -t transform, but not sure how to use it to make it accept .node extension.

Another try is to use webpack, setup loader as node, will accept .node extension, I have not try yet,

Do you think why and what cause the trouble?
Webpack can success?
Browserify can success?
How?

              `/Users/nicole/node/winnow/node_modules/farmhash/build/Release/farmhash.node:1
    ����
      0���__TEXT�__text__TEXT�
                       �m�
                          �__stubs__TEXT�y       ��__stub_helper__TEXT�z��z�__const__TEXT�|%�|__cstring__TEXT�}8�}__gcc_except_tab__TEXT��__unwind_info__TEXT�8�__eh_frame__TEXTX��
             X��__DATA��__nl_symbol_ptr__DATA��0__got__DATA��2__la_symbol_ptr__DATA(��(�5__mod_init_func__DATA���	__data__DATA�����H__LINKEDIT�t�t"�0�  �Pp��`h�8�94�@
        P6��e�꤫�1=��X
                    ��$
       ^
          ParseError: Unexpected character '�'`

Hi, I can see from your cross-post at koopjs/winnow#134 that you've discovered that this module requires Node.js and is unsuitable for a browser-based runtime.

commented

Ok, got it, thanks, I modify source code, remove all farmhash, alternative use require('string-hash'), it works.