thlorenz / browserify-shim

📩 Makes CommonJS incompatible files browserifyable.
MIT License
933 stars 87 forks source link

Shimming Facebook SDK #221

Closed shyamvala closed 7 years ago

shyamvala commented 8 years ago

Hi,

It may not be the right place for asking the question but thought will give it a try if you have come across a similar situation. So as per Facebook documentation the sdk can be used with RequireJS with a shim (https://developers.facebook.com/docs/javascript/howto/requirejs/v2.7). I am big fan of Browserify and wanted apply a similar shim and use it but unfortunately cant get it to work. I keep getting undefined for the reference. I used the following config in my package.json: "browserify": { "transform": [ "browserify-shim" ] }, "browser": { "facebook-sdk": "./public/js/vendor/facebook.js" }, "browserify-shim": { "facebook-sdk": "FB" } And the call require('facebook-sdk') keeps returning me undefined. Any ideas what might be going wrong ?

The facebook sdk typically adds a FB object to window.

Thanks and appreciate your help.

bendrucker commented 7 years ago

Sorry this never got a response. Don't have an answer for you off hand and without an example project with a failing test I won't be able to help. Good luck!