Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
'X Is not a function' in CommonJS

I've got the following code I transformed from a Trypescript, ESM-syntax based file to a Javascript, CJS-syntax file.

const apiClientFactory = require("@vue-storefront/core");

function onCreate(settings) {
  return {
    config: settings,
    client: {},
  };
}

const getPrice = () => {
  console.log("$55,98")
}

const { createApiClient } = apiClientFactory({
  onCreate,
  api: {
    getPrice,
  },
});

module.exports = {
  createApiClient,
};

I can not seem to find if the error "apiClientFactory is not a function" originates from old ESM-based code. Or that the function isn't called properly. However, apiClientFactory is correctly imported (ESM syntax)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

What are you trying to achieve with this?

Because the whole Vue Storefront project uses TypeScript, so I recommend you to use it and follow the procedures and code standards that we are using.

To find a good example on the API please check the code for the integrations of Magento or Vendure.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!