Skip to content

fix: resolve ESM/CommonJS conflict in brainstorming server #774#784

Closed
sarbojitrana wants to merge 1 commit intoobra:mainfrom
sarbojitrana:fix/esm-commonjs-server
Closed

fix: resolve ESM/CommonJS conflict in brainstorming server #774#784
sarbojitrana wants to merge 1 commit intoobra:mainfrom
sarbojitrana:fix/esm-commonjs-server

Conversation

@sarbojitrana
Copy link
Contributor

Fixes #774

Resolves a runtime error in Node.js v25+ where the brainstorming server fails to start due to a module system mismatch.

Problem

The repository is configured with "type": "module" (ESM), but server.js uses CommonJS (require).

Node.js v25 enforces ESM strictly, resulting in:

ReferenceError: require is not defined in ES module scope

Solution

  • Renamed server.jsserver.cjs to explicitly use CommonJS
  • Updated start-server.sh to reference the new file
  • Updated test references to maintain consistency

Before the fix

image

After the fix

image

@obra
Copy link
Owner

obra commented Mar 17, 2026

Thanks @sarbojitrana! Clean fix — exactly the right approach. Cherry-picked your commit to the dev branch (preserving your authorship). Closing the PR since we applied it directly rather than merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual companion server.js fails on Node.js v25+ (ESM/CommonJS conflict)

2 participants