Skip to content

Module Not Found in Next.js - AMD module issue and relative paths. #138

Description

@ahbyass

Next.js tries to load the import as AMD, due to relative path resolution in Webpack to get this library to work you need to add the following to next.config.mjs.

const nextConfig = {
  webpack: (config, { isServer }) => {
    config.module.rules.push({
      test: /\.js$/, // Apply this rule to .js files
      include: /node_modules\/cybersource-rest-client/,
      parser: {
        amd: false, // Disable AMD parsing
      },
    });

    return config;
  },
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions