oven-sh/bun · error · Error

Require with dynamic specifier not supported here.

Error message

Require with dynamic specifier not supported here.

What it means

Error "Require with dynamic specifier not supported here." thrown in oven-sh/bun.

Source

Thrown at src/codegen/builtin-parser.ts:116

        if (match) {
          contents = contents.slice(match[0].length);
          result += ")";
        } else {
          result += ",";
        }
        break;
      }
      i = 1;
    } else if (contents.startsWith("require(")) {
      if (replaceRequire) {
        const staticSpecifier = contents.match(/\brequire\(["']([^"']+)["']\)/);
        if (staticSpecifier) {
          const specifier = staticSpecifier[1];
          result += replaceRequire(specifier);
          contents = contents.slice(staticSpecifier[0].length);
          continue;
        } else {
          throw new Error("Require with dynamic specifier not supported here.");
        }
      } else {
        throw new Error("Require is not supported here.");
      }
    } else {
      console.error(contents.slice(0, 100));
      throw new Error("TODO");
    }
    result += contents.slice(0, i);
    contents = contents.slice(i);
  }

  return { result, rest: contents };
}

function sliceTemplateLiteralSourceCode(contents: string, replace: boolean) {
  let i = 0;
  let result = "";

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at src/codegen/builtin-parser.ts:116 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/e686d9e89710cc61. Report an issue: GitHub.