npm - Multiple entrypoints in typescript external modules not resolved -


i trying build external module, @example/lib typescript multiple entry points. consume this:

import * lib '@example/lib'; import * foobar '@example/lib/foobar'; 

i can build npm module works correctly setting "target": "es5" , "declaration": true in tsconfig, , pointing "main" , "typings" properties in package.json single source location. if this, can import @example/lib without issue.

the problem arises when attempt import @example/lib/foobar. typescript complains "cannot find module @example/lib/foobar". compiled output, can import submodule fine (after being processed webpack).

inside @example/lib project have source files:

index.js index.d.ts foobar.js foobar.d.ts 

and in package.json have:

{     ...     "typings": "index.d.ts"     "main": "index.js"     ... } 

what need keep typescript happy (and type checking!) in case?

the above does, in fact work.

unfortunately in case d.ts file not being generated foobar, (though source was, due error).


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -