gpt4 book ai didi

javascript - VS Typescript 找不到本地文件夹

转载 作者:行者123 更新时间:2023-12-02 21:36:29 24 4
gpt4 key购买 nike

我目前在 Visual Studio 中只有 Typescript 和 Nodejs 项目存储库的外壳,但我无法找出导入错误。我有一个顶级文件 application.ts,在尝试导入具有 index.ts 文件的本地文件夹 source 时出错。我的目录结构如下所示:

package.json
tsconfig.json
application.ts
source
index.ts

并且,appliation.js 中的错误是找不到模块“./source”。

enter image description here

enter image description here

郑重声明,我还尝试了 import { } from 'source',删除了 ./ 但这也不起作用。我在这里错过了一些非常明显的东西吗?

编辑:添加 tsconfig.json 和 package.json 的内容以确保相关性。

enter image description here

enter image description here

最佳答案

我认为如果您将 "include": ["./**/*"] 添加到 tsconfig.json 中,就会解决问题

让它看起来像这样:

保留compilerOptions中的内容并排除,但在中间添加包含,如下所示

"compilerOptions":{},
"include":["./**/*"],
"exclude":[]

关于javascript - VS Typescript 找不到本地文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60480296/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com