是否可以在 TypeScript 中模仿 webpack 自定义模块解析?

Is it possible to mimic webpack custom module resolution in TypeScript?

我无法找到如何让 TS 检查模块不仅 node_modules 目录而且检查其他自定义目录。

我的情况:

# webpack config
resolve: {
  modules: ['components', 'node_modules']
}

# index.vue
import WorkspaceToolbar from 'WorkspaceToolbar' // TS can't find this module since it doesn't look in components dir.

那么,是否可以像 webpack 一样让 TS 检查模块?

我解决了这个问题。这是由于缺乏对TS的了解。要查找模块,我只需要在 *.d.ts 文件中使用 declare module 声明它们。