0

Im sure this is something simple but for the life of me i can't seem to find an answer to my problem. Basically Im using react and webpack and I've installed a new package (in this case braintree-web-drop-in), however the package is always appearing as null (undefined) when i import it into my react module and just try to log it out at the top of the module (or anywhere)

package.json:

"dependencies": { "braintree-web": "^3.32.0", "braintree-web-drop-in": "^1.10.0",

ReactModel.tsx

import brainTree from 'braintree-web-drop-in' console.log(brainTree);

I can also see that the package seems to have been added to my generated js file through webpack.

Any help would be appreciated!

Thanks, James

1 Answer 1

2

To me it looks like this module doesn't have a default export (which the import syntax will use if no named export is asked for).

https://github.com/braintree/braintree-web-drop-in/blob/master/src/index.js#L534

So, in order to see if the module is installed, try this:

import { VERSION } from 'braintree-web-drop-in';
console.log('brain tree version: ', VERSION);

If that works you can use the create with a named import:

import { create} from 'braintree-web-drop-in';
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much! that is 100% what was happening there.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.