Typescript Azure生产类型脚本导入失败
我正在尝试设置一个用typescript开发的Web服务器,并且在本地运行良好。没有关于使用或运行时的错误或警告。不过,我无法将其部署到AzureTypescript Azure生产类型脚本导入失败,typescript,azure,Typescript,Azure,我正在尝试设置一个用typescript开发的Web服务器,并且在本地运行良好。没有关于使用或运行时的错误或警告。不过,我无法将其部署到Azure // import inside website.ts import { do_request } from "./api" // breaks do_request() // function inside the module "api.ts" export function do_request(na
// import inside website.ts
import { do_request } from "./api"
// breaks
do_request()
// function inside the module "api.ts"
export function do_request(name: string, data: any) {
// there is infact stuff in here
}
在这条线的某个地方,会发生这样的情况:
2021-01-22T16:39:13.961567336Z $ cross-env NODE_ENV=production nodemon --exec ts-node src/index.ts -e ts
2021-01-22T16:39:14.997665938Z [33m[nodemon] 2.0.7[39m
2021-01-22T16:39:15.003697468Z [33m[nodemon] to restart at any time, enter `rs`[39m
2021-01-22T16:39:15.006837988Z [33m[nodemon] watching path(s): *.*[39m
2021-01-22T16:39:15.006861089Z [33m[nodemon] watching extensions: ts[39m
2021-01-22T16:39:15.006872090Z [32m[nodemon] starting `ts-node src/index.ts`[39m
2021-01-22T16:39:34.553414244Z ... environment: production
2021-01-22T16:39:38.264762256Z ... caching
2021-01-22T16:39:57.536570340Z ... finished
2021-01-22T16:39:59.879985595Z ... server listening on port 8080
2021-01-22T16:40:01.061256273Z ... azure storage directory ready
2021-01-22T17:03:33.811212805Z
2021-01-22T17:03:33.811396011Z /home/site/wwwroot/src/server/website.ts:150
2021-01-22T17:03:33.811428912Z do_request(requestType, json)
2021-01-22T17:03:33.811441213Z ^
2021-01-22T17:03:33.811449613Z TypeError: api_1.do_request is not a function
2021-01-22T17:03:33.811457813Z at IncomingMessage.<anonymous> (/home/site/wwwroot/src/server/website.ts:150:3)
2021-01-22T17:03:33.817172614Z at IncomingMessage.emit (node:events:388:22)
2021-01-22T17:03:33.817201815Z at IncomingMessage.EventEmitter.emit (node:domain:470:12)
2021-01-22T17:03:33.817210915Z at endReadableNT (node:internal/streams/readable:1295:12)
2021-01-22T17:03:33.817219316Z at processTicksAndRejections (node:internal/process/task_queues:80:21)
您要将部署到哪个Azure服务?Azure功能
此外,你现在是怎么做的?在VS代码中或在CLI中使用。您试过了吗?我正在通过vscode部署。我还没有检查那个链接,因为我勇敢的谷歌搜索并没有显示给我。我可能把构建过程搞砸了,因为从typescript生成的api.js文件有一个旧的导出定义,而不是我正在使用的新名称。谢谢!这种联系起了作用。我不得不添加一个脚本来编译类型脚本。
// the same issue appears here, except it errors with "x has no constructor"
import Bot from "./bot"
// broken statement
const bot = new Bot()