You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Igor Tkach (JIRA)" <ji...@apache.org> on 2015/02/10 17:49:11 UTC

[jira] [Updated] (THRIFT-2995) nodejs: index.js requires too much

     [ https://issues.apache.org/jira/browse/THRIFT-2995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Tkach updated THRIFT-2995:
-------------------------------
    Description: 
THRIFT-2387 requested centralizing external exports in index.js. Required modules that are now in  index.js create unnecessary and problematic dependencies  which make it impossible to use thrift module in browser via tools like webpack. Client code may avoid using {{require('thrift')}} import like so:

{{var options = {
    transport: require('thrift/transport').TBufferedTransport,
    protocol: require('thrift/protocol').TBinaryProtocol,
    path: "/",
    headers: {"Connection": "close"},
    https: false,
    responseType: 'arraybuffer'
  };
  var httpConnection = require('thrift/http_connection');
  var con = httpConnection.createHttpConnection("localhost", 8888, options);
  var client = httpConnection.createHttpClient(MyService, con);}}   

but unfortunately generated {{MyService}} nodejs module contains  {{require('thrift')}} which tries to bring in connection, ws_connection, server and web_server all of which of course are unwanted in the browser and depend on node modules that can't work in the browser.
  



  was:
THRIFT-2387 requested centralizing external exports in index.js. Required modules that are now in  index.js create unnecessary and problematic dependencies  which make it impossible to use thrift module in browser via tools like webpack. Client code may avoid using {{require('thrift')}} import like so:

{{
var options = {
    transport: require('thrift/transport').TBufferedTransport,
    protocol: require('thrift/protocol').TBinaryProtocol,
    path: "/",
    headers: {"Connection": "close"},
    https: false,
    responseType: 'arraybuffer'
  };
  var httpConnection = require('thrift/http_connection');
  var con = httpConnection.createHttpConnection("localhost", 8888, options);
  var client = httpConnection.createHttpClient(MyService, con);
}}   

but unfortunately generated {{MyService}} nodejs module contains  {{require('thrift')}} which tries to bring in connection, ws_connection, server and web_server all of which of course are unwanted in the browser and depend on node modules that can't work in the browser.
  




> nodejs: index.js requires too much
> ----------------------------------
>
>                 Key: THRIFT-2995
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2995
>             Project: Thrift
>          Issue Type: Bug
>          Components: Node.js - Library
>    Affects Versions: 0.9.2
>         Environment: webpack
>            Reporter: Igor Tkach
>
> THRIFT-2387 requested centralizing external exports in index.js. Required modules that are now in  index.js create unnecessary and problematic dependencies  which make it impossible to use thrift module in browser via tools like webpack. Client code may avoid using {{require('thrift')}} import like so:
> {{var options = {
>     transport: require('thrift/transport').TBufferedTransport,
>     protocol: require('thrift/protocol').TBinaryProtocol,
>     path: "/",
>     headers: {"Connection": "close"},
>     https: false,
>     responseType: 'arraybuffer'
>   };
>   var httpConnection = require('thrift/http_connection');
>   var con = httpConnection.createHttpConnection("localhost", 8888, options);
>   var client = httpConnection.createHttpClient(MyService, con);}}   
> but unfortunately generated {{MyService}} nodejs module contains  {{require('thrift')}} which tries to bring in connection, ws_connection, server and web_server all of which of course are unwanted in the browser and depend on node modules that can't work in the browser.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)