bun icon indicating copy to clipboard operation
bun copied to clipboard

[bun build] in cjs node, dont convert `module` to `require.module`

Open RiskyMH opened this issue 5 months ago • 3 comments

What does this PR do?

fixes #20308

Context: module gets converted to require.module in --format=cjs --target=node, unfortunately that isn't actually a thing in node/bun so this pr lets it stay to the base module. I'm not sure if this is the right way of going about it and if it effects esm outputs.

  • [ ] Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • [ ] Code changes

How did you verify your code works?

modified existing test to fit cjs mode, and ran it

RiskyMH avatar Jun 12 '25 13:06 RiskyMH

Updated 7:45 AM PT - Jun 12th, 2025

:x: @RiskyMH, your commit 1a82d565b3423fd5406adf82f1334d2a3c2ff54b has 1 failures in Build #18556:


🧪   To try this PR locally:

bunx bun-pr 20343

That installs a local version of the PR into your bun-20343 executable, so you can run:

bun-20343 --bun

robobun avatar Jun 12 '25 13:06 robobun

I don't think it should ever be require.module? I think this code probably meant module.require which should work

Jarred-Sumner avatar Jun 12 '25 14:06 Jarred-Sumner

I don't think it should ever be require.module? I think this code probably meant module.require which should work

The earlier line (if (p.options.require_ref) |require| { p.printSymbol(require);) is what is used for the esm path. If I get rid of that code then the test right before the one I added fails. So I'd assume it is intended outcome, just not for cjs format.

RiskyMH avatar Jun 12 '25 14:06 RiskyMH