oven-sh/bun · error · Error

Require is not supported here.

Error message

Require is not supported here.

What it means

Error "Require is not supported here." thrown in oven-sh/bun.

Source

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

        } 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 = "";
  while (contents.length) {
    i = contents.match(/`|\${/)!.index!;
    result += contents.slice(0, i);

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at src/codegen/builtin-parser.ts:119 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/a183824c4cf8f7be. Report an issue: GitHub.