Skip to content

Building with --format cjs and --no-bundle ignores cjs format #29187

@CosmoCreeper

Description

@CosmoCreeper

What version of Bun is running?

1.3.5+1e86cebd7

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What steps can reproduce the bug?

Create a TypeScript file with some simple imports and exports and build it with a specific build command:
bun build ./index.ts --outfile ./index.js --target node --format cjs --no-bundle

What is the expected behavior?

I'm looking to be able to output a file that is still readable and uses external imports, meanwhile being compatible with CommonJS.

What do you see instead?

An ESM JS file using import and export features.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions