1

I'm trying to get this code:

https://github.com/bersling/typescript-library-starter

working that I found from this:

https://stackoverflow.com/a/44617078/1715055

answer.

I manually compiled the package and added it to a test package's node_modules/ folder.

With --traceResolution, I'm getting:

30 Loading module 'typescript-library-starter/hello-word' from 'node_modules' folder, target file type 'TypeScript'. 31 Directory '/home/ubuntu/test/ts_module/app/src/node_modules' does not exist, skipping all lookups in it. 32 Found 'package.json' at '/home/ubuntu/test/ts_module/app/node_modules/typescript-library-starter/package.json'. 33 File '/home/ubuntu/test/ts_module/app/node_modules/typescript-library-starter/hello-word.ts' does not exist. 34 File '/home/ubuntu/test/ts_module/app/node_modules/typescript-library-starter/hello-word.tsx' does not exist. 35 File '/home/ubuntu/test/ts_module/app/node_modules/typescript-library-starter/hello-word.d.ts' does not exist.

In other words, it's not detecting the types field in package.json. I installed another Typescript package that includes the typings field, and while tracing it is correctly resolving:

11 Found 'package.json' at '/home/ubuntu/test/ts_module/app/node_modules/json-schema-to-typescript/package.json'. 12 'package.json' has 'typings' field 'dist/src/index.d.ts' that references '/home/ubuntu/test/ts_module/app/node_modules/json-schema-to-typescript/dist/src/index.d.ts'. 13 File '/home/ubuntu/test/ts_module/app/node_modules/json-schema-to-typescript/dist/src/index.d.ts' exist - use it as a name resolution result. .

Edit: My tsc --version is 2.6.1 and I've tried using 'typings' alone and both 'typings' and 'types'.

John
  • 3,037
  • 8
  • 36
  • 68
  • Well you can try to first build the module and then while inside the module issue `yarn link`. Then go inside the client app and issue `yarn link hwrld`. That will do it. – arpl Dec 17 '17 at 16:45
  • Client app is where you're planning to use the `hwrld` module. – arpl Dec 17 '17 at 16:45

0 Answers0