CyberSource / CyberSource/cybersource-rest-client-node

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

Open
#138 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
49
Forks
50
Avg merge
18m
Merged PRs (30d)
2

Description

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;
  },
};

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported next.config.mjs webpack workaround and inspect how the package is imported by Next.js, focusing on the relative-path and AMD parsing behavior described in the issue. Reproduce the Module Not Found failure and establish whether the library can work without consumer-side configuration; the issue does not name a repository file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, webpack
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.