shippo-node-client icon indicating copy to clipboard operation
shippo-node-client copied to clipboard

ES6 Imports Don't Work

Open osseonews opened this issue 3 years ago • 1 comments
trafficstars

We are able to successfully use Require to use this library, but using imports doesn't work, and unfortunately our current set up requires imports.

Whenever we import, we get 400 response with "Invalid credentials". We know our credential are fine, as we use them daily in another app which uses require. how do you use this library with Imports?

Our code:

import * as Shippo from 'shippo'
const shippo = new Shippo.default('YOURSHIPPOID');

osseonews avatar May 18 '22 15:05 osseonews

This works for me

import shippo from "shippo"

shippo(SHIPPO_API_KEY).carrieraccount.list().then(r => console.log(r))

OR

import shippo from "shippo"

const client = shippo(SHIPPO_API_KEY)
client.carrieraccount.list().then(r => console.log(r))

macder avatar Jun 08 '22 23:06 macder