Skip to content

Bun html dev server ReferenceError: exports is not defined when using certain dependencies #17991

@RiskyMH

Description

@RiskyMH

What version of Bun is running?

1.2.5-canary.109+589fa6274

What platform is your computer?

windows

What steps can reproduce the bug?

  1. make index.js and index.html
  2. install @paralleldrive/cuid2
  3. run dev mode - bun index.html
  4. open browser
// index.js
import { createId } from "@paralleldrive/cuid2"; 
console.log(createId())
<!-- index.html -->
<script type="module" src="index.js"></script>

What is the expected behavior?

to log a random string in console

What do you see instead?

ReferenceError: exports is not defined
  at ../node_modules/ in paralleldrive/cuid2/src/index.js@http://localhost:3000/_bun/client/a-000000008c84d02b.js:93:5
  at ../node_modules/ in paralleldrive/cuid2/index.js@http://localhost:3000/_bun/client/a-000000008c84d02b.js:25:69
  at 

Additional information

Works in bun build of the html/js, and in normal runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    bake:devhot-reloading dev server for client+server applicationsbugSomething isn't workingconfirmed bugWe can reproduce this issueregression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions