-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Closed
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.
Description
When creating workers from within modules, we don't have __filename
or __dirname
so rather have to rely on import.meta.url, something like:
import { Worker } from 'worker_threads';
import { fileURLToPath } from 'url';
new Worker(fileURLToPath(import.meta.url));
To avoid the fileURLToPath
call being necessary here, should we consider supporting URLs as input into new Worker
?
sindresorhus
Metadata
Metadata
Assignees
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.