我读了TypeScript 模块解析的工作原理.
我有以下存储库:ts-di.编译目录结构后如下:
??? dist
? ??? annotations.d.ts
? ??? annotations.js
? ??? index.d.ts
? ??? index.js
? ??? injector.d.ts
? ??? injector.js
? ??? profiler.d.ts
? ??? profiler.js
? ??? providers.d.ts
? ??? providers.js
? ??? util.d.ts
? ??? util.js
??? LICENSE
??? package.json
??? README.md
??? src
? ??? annotations.ts
? ??? index.ts
? ??? injector.ts
? ??? profiler.ts
? ??? providers.ts
? ??? util.ts
??? tsconfig.json
Run Code Online (Sandbox Code Playgroud)
在我的package.json中,我写道"main": "dist/index.js"
.
在Node.js中一切正常,但TypeScript:
import {Injector} from …
Run Code Online (Sandbox Code Playgroud)