Skip to content

bun throws "Expected CommonJS module to have a function wrapper" importing @discordjs/builders #20718

Open
@3030years

Description

@3030years

What version of Bun is running?

1.2.17

What platform is your computer?

Linux 6.1.0-37-amd64 x86_64 unknown

What steps can reproduce the bug?

Dependencies: @discord.js/builders
Make 2 files a.ts and b.ts

// a.ts
import("./b.ts")
// b.ts
import { SlashCommandBuilder } from '@discordjs/builders';

module.exports = {
    d: new SlashCommandBuilder() 
}

now run a.ts and bun will crash

What is the expected behavior?

It to be blank as it shouldn't log anything.

What do you see instead?

 6 |     "use strict";
 7 | 
 8 |     //
 9 |     if (entry.instantiate)
10 |         return entry.instantiate;
11 |     var instantiatePromise = (async () => {
                                               ^
TypeError: Expected CommonJS module to have a function wrapper. If you weren't messing around with Bun's internals, this is a bug in Bun

Bun v1.2.17 (Linux x64)

Additional information

This is my first bug report. Hopefully I formatted everything correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions