mjohnston / react-native-webpack-server

Build React Native apps with Webpack
MIT License
933 stars 84 forks source link

Fixed commander API bug with this.opts() #151

Closed jordaaash closed 8 years ago

jordaaash commented 8 years ago
[...]/node_modules/react-native-webpack-server/bin/rnws.js:126
    const opts = options.opts();
                         ^

TypeError: options.opts is not a function

The correct Commander method for getting the options passed is this.opts(). This means that rwns bundle has not been functioning correctly when called with options since 14eecdf42cbc2ae933870a407f3d5d2ed30d65f8

philikon commented 8 years ago

Thanks for the PR!

This means that rwns bundle has not been functioning correctly when called with options since 14eecdf

Weird, that's not what I've been seeing. All options seem to work just fine here. In fact, reading the commander code at https://github.com/tj/commander.js/blob/272e22ffa8f7dea42ebc831bd4ad900ae893a17a/index.js#L292-L301, it seems that this.opts() and options.opts() should be equivalent, because the action callback will always be called with self as this and as the last (and in our case only) argument.

Can you provide detailed steps to reproduce (environment, exact version numbers, etc.) on how you got the above error?

jordaaash commented 8 years ago

You know what, this was due to running the bin via node (using the debugger while testing), which screwed up the options passed to the bundle command. Closing this.