[ https://issues.apache.org/jira/browse/THRIFT-3546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15565392#comment-15565392 ]
Benjamin Gould commented on THRIFT-3546: ---------------------------------------- Added to my PR to emit a "use strict" directive at the top of generated node.js files and confirmed that they work properly in Chrome and Firefox when run through browserify. Additionally, I confirmed that the generated code can be used with babel. > NodeJS code should not be namespaced (and is currently not strict-mode > compliant) > --------------------------------------------------------------------------------- > > Key: THRIFT-3546 > URL: https://issues.apache.org/jira/browse/THRIFT-3546 > Project: Thrift > Issue Type: Bug > Components: Node.js - Compiler > Affects Versions: 0.9.3 > Reporter: Yunchi Luo > > Code generated for NodeJS, whether with a js namespace specified or not, > seems to fail strict mode. Specifically, it doesn't always generate "var" > when needed. This might not sound like a big issue but it's quite a pain to > deal with... > It is standard nowadays to enable strict mode for Javascript code > (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode). > And babel, which is one of most popular ES6 => ES5 transpilers, while does > not force strict mode, does seem to break when you don't use "var". > I think the best solution here is really to just stop using namespaces in > node code. Every type will be declared with "var", and if exported, also > assigned to "module.exports". > I don't believe namespaces currently generated in the node code is directly > used anywhere or is even accessible outside the file? -- This message was sent by Atlassian JIRA (v6.3.4#6332)