Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making it less annoying to bundle signal in the browser #2

Open
elsehow opened this issue Dec 14, 2016 · 2 comments
Open

Making it less annoying to bundle signal in the browser #2

elsehow opened this issue Dec 14, 2016 · 2 comments

Comments

@elsehow
Copy link
Owner

elsehow commented Dec 14, 2016

If I npm install signal-protcol for my app, and require it in my browser bundle, I get

Users/ffff/empty-browser-module/node_modules/node-webcrypto-ossl/build/Release/nodessl.node:1
����
   ����__TEXT __text__TEXT�
                           �g�
                              �__stubs__TEXT�s>��__stub_helper__TEXT�w��w�__const__TEXT�~/�~__gcc_except_tab__TEXT��I�__cstring__TEXT����__unwind_info__TEXT���	��__eh_frame__TEXTH��EH�(__DATA    __got__DATA  �__nl_symbol_ptr__DATA!!�__la_symbol_ptr__DATA !� !�__mod_init_func__DATA��&	__const__DATA�&�&__data__DATA@/`@/H__LINKEDIT@�@��"�0@xx@ �B��EH��&��
^
ParseError: Unexpected character '�'

As it says in the README, I would now need to configure my bundler to exclude/ignore ./node_modules/signal-protocol/src/node_polyfills.js.

This is really not the friendliest solution. How can we work around this? How have other modules worked around this issue?

@anupsv
Copy link

anupsv commented Jul 29, 2017

Hi, i am getting the same error when using it with angular 4. But trying to exclude the file did not work. this is my tsconfig.json compiler options

  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ],
    "exclude": [
      "./node_modules/signal-protocol/src/node_polyfills.js"
    ]
  }

Any advice ?

@elsehow
Copy link
Owner Author

elsehow commented Jul 29, 2017

Hey @anupsv

The only explanation I could think of here is that bundler isn't excluding node_polyfills.js. Is there any way you can test that files in "exclude" are actually being excluded? For example, maybe you could backup node_polyfills.js, replace it with some file that has an easy-to-find string in there, do the compilation, then check the bundled file to assure that this string really isn't in the bundle. We can go from there.

@elsehow elsehow closed this as completed Nov 2, 2019
@elsehow elsehow reopened this Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants