workerpool icon indicating copy to clipboard operation
workerpool copied to clipboard

Working with typescript causing an error: The worker script extension must be \".js\", \".mjs\", or \".cjs\". Received \".ts\"

Open PrabhuPuredla95 opened this issue 4 years ago • 3 comments

var workerpool = require('workerpool') var pool = workerpool.pool(__dirname + '/../workers/bulk_operations.ts') //causing the error

I have installed this module as well: https://www.npmjs.com/package/@types/workerpool

PrabhuPuredla95 avatar Apr 27 '22 16:04 PrabhuPuredla95

Node version: v14.19.0 typescript: v4.4.3

Early response would be highly appreciated

PrabhuPuredla95 avatar Apr 27 '22 16:04 PrabhuPuredla95

You'll first need to create a bundle of your bulk_operations.ts file, and then load that bundle as worker.

See also #189

josdejong avatar Apr 28 '22 06:04 josdejong

Thank you. Will try and let you know

PrabhuPuredla95 avatar Apr 28 '22 15:04 PrabhuPuredla95