【发布时间】:2022-02-19 19:01:59
【问题描述】:
我计划为 socket.io 房间设置工作线程。我在第一次连接到房间时创建了一个工作线程,然后设置了 firebase 侦听器。
不幸的是。我在工作文件和我的主要源代码中有常见的导入。
我按照这篇文章允许通过worker_threads运行ts文件-> https://wanago.io/2019/05/06/node-js-typescript-12-worker-threads/
不幸的是,我没有得到顶级等待,并且在启动工作线程时,我收到以下错误。
error TS2451: Cannot redeclare block-scoped variable 'tslib_1'.\r\n"
这是我的 tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"lib": ["esnext"],
"module": "commonjs",
"importHelpers": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"baseUrl": ".",
"sourceMap": true,
"declaration": false,
"noImplicitAny": false,
},
"files": [
"typings.d.ts"
],
}
【问题讨论】:
标签: node.js typescript ts-node worker-thread