siriwave: Module import does not work with Typescript

Hi @kopiro Thank you for creating an amazing library. I was trying to use it my Typescript application with import SiriWave from 'siriwave'; but I get Cannot find module 'siriwave ts(2307)'. literally with any compilerOptions.module variants in tsconfig.ts.

Typescript module resolution gives me the following:

======== Resolving module 'siriwave' from 'c:/Projects/tstest/app.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module 'siriwave' from 'node_modules' folder, target file type 'TypeScript'.
Found 'package.json' at 'c:/Projects/tstest/node_modules/siriwave/package.json'.
'package.json' does not have a 'typesVersions' field.
File 'c:/Projects/tstest/node_modules/siriwave.ts' does not exist.
File 'c:/Projects/tstest/node_modules/siriwave.tsx' does not exist.
File 'c:/Projects/tstest/node_modules/siriwave.d.ts' does not exist.
'package.json' does not have a 'typings' field.
'package.json' does not have a 'types' field.
'package.json' does not have a 'main' field.
File 'c:/Projects/tstest/node_modules/siriwave/index.ts' does not exist.
File 'c:/Projects/tstest/node_modules/siriwave/index.tsx' does not exist.
File 'c:/Projects/tstest/node_modules/siriwave/index.d.ts' does not exist.
Directory 'c:/Projects/tstest/node_modules/@types' does not exist, skipping all lookups in it.
Directory 'c:/Projects/node_modules' does not exist, skipping all lookups in it.    
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
Loading module 'siriwave' from 'node_modules' folder, target file type 'JavaScript'.
Found 'package.json' at 'c:/Projects/tstest/node_modules/siriwave/package.json'.
'package.json' does not have a 'typesVersions' field.
File 'c:/Projects/tstest/node_modules/siriwave.js' does not exist.
File 'c:/Projects/tstest/node_modules/siriwave.jsx' does not exist.
'package.json' does not have a 'main' field.
File 'c:/Projects/tstest/node_modules/siriwave/index.js' does not exist.
File 'c:/Projects/tstest/node_modules/siriwave/index.jsx' does not exist.
Directory 'c:/Projects/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
======== Module name 'siriwave' was not resolved. ========

As a workaround I have added "main": "dist/siriwave.js" to package.json but I’m not sure that this is the way to go with rollup.js compilation. Meaning I do not know if rollup.js js generates package.json for you or not. Any suggestions on how to make the library usable in Typescript in the sane way?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Sadly I know what happened to them… there is a bug in the rollup-plugin-typescript library. I have to generate d.ts files separately. I’m gonna fix it and publish probably today!