threads.js
threads.js copied to clipboard
Worker Path Module not found
I am trying to load Worker from same directory in nodejs typescript it always throws Error: Cannot find module I tried to load using relative path and also by absolute path but it always failed
Was literally about to post the same message...I have this:
import { Pool, spawn, Worker } from 'threads';
import * as w from './Worker';
export class EngineLearn {
trainModels = async () => {
const pool = Pool(() => spawn(new Worker('./Worker')));
// ...do stuff with pool
};
}
Error: Cannot find module 'engine-learn/Worker`
I am using @nrwl/esbuild:esbuild
with Nx.