【问题标题】:How to avoid jumping to d.ts in a monorepo with shared package如何避免在带有共享包的 monorepo 中跳转到 d.ts
【发布时间】:2019-09-10 06:38:59
【问题描述】:

我使用 Yarn 工作区创建了一个打字稿 monorepo。一个包“公用”由其他包共享。

它的package.json是这样配置的:

  "main": "dist/index.js",
  "typings": "dist/index.d.ts",
  "files": [
    "dist/**/*"
  ],

每当我使用“转到定义”或 cmd+单击 VSCode 中的函数时,它会将我带到 d.ts 文件而不是原始的打字稿定义。这真的损害了我的工作流程。

在我将 main 简单地设置为 TS 源文件之前,它与跳转到功能一起使用,但它不可部署,因为在部署期间某些包是在云中构建的,因此需要使用通用包发布常规的 javascript / NPM 接口使其工作。

有解决办法吗?

【问题讨论】:

    标签: typescript visual-studio-code monorepo yarn-workspaces


    【解决方案1】:

    删除typings 字段。根据the docs,指定files 时会被忽略,只会混淆IDE...

    【讨论】:

      猜你喜欢
      • 2020-02-13
      • 2022-06-25
      • 1970-01-01
      • 2012-02-07
      • 2021-07-21
      • 2016-05-03
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      相关资源
      最近更新 更多