mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
237 stars 63 forks source link

Error on lodash dependency #140

Closed waartaal closed 4 years ago

waartaal commented 4 years ago

Hi,

If I load in the example code to do a subscription. I get a dependency error from lodash. I have checked how to fixed for an hour or two, but I couldn't find a sure way. And I also could not find a way to make sure it transfers over to production. Help is appreciated.

Written in svelte/sapper (is readable if you don't know it). Page is a separate route within Sapper. www.example.com/subscription.

'toPlainObject' is not exported by node_modules/lodash/lodash.js, imported by node_modules/@mollie/api-client/dist/mollie.esm.js

import { toPlainObject, isPlainObject, get, has, cloneDeep, startsWith, defaults } from 'lodash';

<script>
  import createMollieClient from "@mollie/api-client";

  const mollieClient = createMollieClient({
    apiKey: "test_code"
  });

  async function subscribe() {
    const subscription = await mollieClient.customers_subscriptions.create({
      customerId: "cst_stTC2WHAuS",
      amount: {
        currency: "EUR",
        value: "25.00"
      },
      times: 4,
      interval: "3 months",
      description: "Quarterly payment",
      webhookUrl: "https://webshop.example.org/subscriptions/webhook/"
    });
  }
</script>

<button type="button" on:click={subscribe}>SUB</button>
waartaal commented 4 years ago

Updated first post with error message. I switched to yarn to mess about with version control of dependencies. No luck thusfar.

as above: 'toPlainObject' is not exported by node_modules/lodash/lodash.js, imported by node_modules/@mollie/api-client/dist/mollie.esm.js