You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm making my first experiences with NodeJS worker threads and ran into something that makes me wonder if tsdown (or Rolldown) needs to address this. It should be noted that I did not find anything for other bundlers. But let me describe my problem first:
import{Worker}from'worker_threads';constworker=newWorker('./worker.ts',{// ← it's about the first argumentworkerData: {},});
This works fine before bundling, since worker.ts is a file in my source folder. However, once bundled, this file will be named worker.mjs – I will run into a "file not found" error at runtime.
I can imagine employing a couple of workarounds for this:
use .mjs in the source
use a plugin such as @rollup/plugin-replace
create a barrel .mjs file that imports .ts
What's your opinion on this? Do you feel this is something that should be handled by a bundler? If so, is this the right repository to bring this up or should it be escalated to Rolldown?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm making my first experiences with NodeJS worker threads and ran into something that makes me wonder if
tsdown(or Rolldown) needs to address this. It should be noted that I did not find anything for other bundlers. But let me describe my problem first:This works fine before bundling, since
worker.tsis a file in my source folder. However, once bundled, this file will be namedworker.mjs– I will run into a "file not found" error at runtime.I can imagine employing a couple of workarounds for this:
.mjsin the source@rollup/plugin-replacecreate a barrel.mjsfile that imports.tsWhat's your opinion on this? Do you feel this is something that should be handled by a bundler? If so, is this the right repository to bring this up or should it be escalated to Rolldown?
Beta Was this translation helpful? Give feedback.
All reactions