skip to Main Content

As the title indicates, I have a next.js(13.2.0) project and I have installed firestore-stripe-payments package. But when I import { getStripePayments } from "@stripe/firestore-stripe-payments"; I receive SyntaxError: Unexpected token ‘export’. I am very new to react and next.js but from what I am understanding that issue was solved with next.js v13, why am I getting that error? Below is the log screen

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution for anyone who struggles with the same problem. In next.config.js put that line of code in module.exports: transpilePackages: ["name-of-the-package"]


  2. @chris_ provided the correct answer, but for those who didn’t follow, here’s what your code should look like.

    In the next.config.js file:

    /** @type {import('next').NextConfig} */
    const nextConfig = {
      reactStrictMode: true,
      images: {
        domains: ["name-of-domains"],
      },
      transpilePackages: ["name-of-the-package"],
    };
    
    module.exports = nextConfig;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search