Skip to content

Node Worker not started in DEV mode #240

@aheissenberger

Description

@aheissenberger

Describe the bug

Works with pnpm build and pnpm start but fails pnpm dev:

Error: Not running in a worker thread - Click to expand the full error!
[react-server] Ctrl+C to exit 🚫
[react-server] Not running in a worker thread
[react-server]   [stack]: Error: Not running in a worker thread
[react-server]     at /rs-bug-node-worker/src/DEMO/api-worker.ts:4:9
[react-server]     at ESModulesEvaluator.runInlinedModule (file:///rs-bug-node-worker/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_terser@_d4d69b3d57cfb5ebe5fd478306091e9d/node_modules/rolldown-vite/dist/node/module-runner.js:1062:5)
[react-server]     at RSCModuleRunner.directRequest (file:///rs-bug-node-worker/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_terser@_d4d69b3d57cfb5ebe5fd478306091e9d/node_modules/rolldown-vite/dist/node/module-runner.js:1284:61)
[react-server]     at RSCModuleRunner.cachedRequest (file:///rs-bug-node-worker/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_terser@_d4d69b3d57cfb5ebe5fd478306091e9d/node_modules/rolldown-vite/dist/node/module-runner.js:1180:76)
[react-server]     at /rs-bug-node-worker/src/DEMO/api.ts:1:1
[react-server]     at ESModulesEvaluator.runInlinedModule (file:///rs-bug-node-worker/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_terser@_d4d69b3d57cfb5ebe5fd478306091e9d/node_modules/rolldown-vite/dist/node/module-runner.js:1062:5)
[react-server]     at RSCModuleRunner.directRequest (file:///rs-bug-node-worker/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_terser@_d4d69b3d57cfb5ebe5fd478306091e9d/node_modules/rolldown-vite/dist/node/module-runner.js:1284:61)
[react-server]     at RSCModuleRunner.cachedRequest (file:///rs-bug-node-worker/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_terser@_d4d69b3d57cfb5ebe5fd478306091e9d/node_modules/rolldown-vite/dist/node/module-runner.js:1180:76)
[react-server]     at /rs-bug-node-worker/src/App.tsx:5:1
[react-server]     at ESModulesEvaluator.runInlinedModule (file:///rs-bug-node-worker/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_terser@_d4d69b3d57cfb5ebe5fd478306091e9d/node_modules/rolldown-vite/dist/node/module-runner.js:1062:5)

I prepared an example repository with the problem:
https://github.com/aheissenberger/rs-bug-node-worker

All relevant files have a comment // DEMO included:

  • /src/DEMO - here is a demo api and the worker
  • src/App.tsx - server page which calls the api and starts the worker
  • vite.config.ts - build using the vite plugin @fetsorn/vite-node-worker

Is there a better place to start the worker on start of the application and a better way to provide the api?

Reproduction

https://github.com/aheissenberger/rs-bug-node-worker

Steps to reproduce

No response

System Info

System:
    OS: macOS 15.6.1
    CPU: (12) arm64 Apple M4 Pro
    Memory: 2.93 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.6.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.5.1 - /opt/homebrew/bin/npm
    pnpm: 10.15.0 - /opt/homebrew/bin/pnpm
    bun: 1.2.20 - /opt/homebrew/bin/bun
  npmPackages:
    @lazarv/react-server: 0.0.0-experimental-2dab5bb-20250522-222c3bcf => 0.0.0-experimental-2dab5bb-20250522-222c3bcf 
    @lazarv/react-server-adapter-vercel: 0.0.0-experimental-138ef89-20241217-08cf78b6 => 0.0.0-experimental-138ef89-20241217-08cf78b6 
    vite: ^6.3.5 => 6.3.5

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions