Node v12 cant resolve worker_threads

829 views Asked by At

I am using nodejs v12.18.3 and npm v6.14.6 to make a react project. I am trying to import worker_threads module but it can't resolve the module name (even though vs code can find the definition). I have confirmed the file exists at node_modules/@types/node/worker_threads.d.ts. My package lists "@types/node": "^14.14.41" as a dependency. Why does it not find the worker_threads module?

Here are some of the import statements I have tried

import Worker from 'worker_threads';
import {Worker} from 'worker_threads';
import * as wt from 'worker_threads';
import Worker from '@types/node/worker_threads';
import Worker from 'node/worker_threads';
const Worker = require('worker_threads');
0

There are 0 answers