【发布时间】:2019-08-18 10:00:46
【问题描述】:
Here 的 Github MCVE 显示问题。 npm run compile 显示错误。
我正在尝试这样做:
import {Todo} from '@test';
但它没有解决。
src/index.ts:1:20 - 错误 TS2307:找不到模块“@test”。
我在tsconfig.json 中有paths。
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"paths": {
"@fs/": ["src/"],
"@test/": ["test/"]
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
想法?
Github Typescript 问题
I opened a bug report for this here 因为根据某些 cmets 它应该可以工作。
Typescript 请注意,我更新了 github 存储库,删除了 @test 中的 glob 模式和斜线。
【问题讨论】:
-
In the docs 在路径映射下,他们将基本 url 设置为
. -
@pmkro
.和./解析到同一个目录,相反会是一个TS实现的bug -
@NinoFiliu 我想了很多
标签: javascript node.js typescript tsconfig