【问题标题】:How to show .js file under .ts file in VS Code?如何在 VS Code 中的 .ts 文件下显示 .js 文件?
【发布时间】:2018-07-04 16:56:19
【问题描述】:

我正在将 VS Code 用于使用 Reactjs 和 TypeScript 的应用程序。我用过

create-react-app-typescript

作为设置我的项目的模板。现在,当我从 VS Code 运行构建任务时,我可以看到构建文件夹和生成的 js 文件以及生成的源文件。

我想知道我是否可以在 VS Code 的 .ts 版本下看到生成的 .js 文件 - 就像您可以在 Visual Studio 中一起看到这些文件一样?

【问题讨论】:

    标签: javascript reactjs typescript visual-studio-code web-frontend


    【解决方案1】:

    我是 VSCode Typescript 用户。我从未见过 VSCode 中提供了该功能。我通常做的一件事是在侧边栏隐藏它的 javascript 文件。

    {
        "files.exclude": {
            "**/.git": true,
            "**/.DS_Store": true,
            "**/*.js": {"when": "$(basename).ts"}
        }
    }
    

    【讨论】:

      【解决方案2】:

      我的应用程序文件夹中有一个 tsconfig 文件,其中

      "outDir": "build/dist" 
      

      导致生成的文件进入 build/dist 文件夹。为 tsconfig.json 文件删除此文件会将生成的文件与原始 .ts 文件一起放置在 VS Code 中。

      【讨论】:

        猜你喜欢
        • 2018-12-06
        • 1970-01-01
        • 2019-07-01
        • 2016-07-07
        • 2018-07-29
        • 2021-05-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多