Skip to content

ReScript 12 Monorepo with Bun 1.3.x - Working Example #2

@joakin

Description

@joakin

Hi @nojaf,

Following up on the forum discussion, I've created a working ReScript 12 monorepo example that demonstrates the current workarounds needed for Bun 1.3.x compatibility. You can find it here: https://github.com/joakin/rescript-bun-monorepo

Like I mentioned in the post, there are a couple of workarounds I implemented:

  1. Bun Isolated Dependencies Fix
  • I added workspace packages to root package.json dependencies to force symlinks in node_modules
  • This allows ReScript's rewatch to find the packages since Bun 1.3.x uses isolated installs by default
  1. Test Discovery Workaround
  • I'm using .res.js suffix (as recommended in docs and the create-rescript-app thingy)
  • I added explicit test scripts with glob patterns since Bun doesn't auto-discover .res.js test files and as far as I could see it is not configurable for now
test: bun test ./packages/*/src/**/*_test.res.js,
test:watch: bun test --watch ./packages/*/src/**/*_test.res.js

Before I submit this as an end-to-end test case, I'd appreciate your thoughts on:

  1. Is that repo enough for you to make something useful in this one, or do you want me to submit it?
  2. Should I keep the current .res.js suffix with the test script workaround, or switch to .js as you mentioned in the end-to-end repo? Not sure if I'm supposed to submit the default or the workaround fixed.
  3. Is the workspace dependency approach acceptable for the end-to-end tests, or would you prefer a different solution (like configuring Bun with linker = "hoisted" in bunfig.toml)? Or leave it broken without the package.json dependencies on the packages/*?

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions