eldargab/easy-table

error TS2307: Cannot find module 'easy-table'

ngmariusz opened this issue · 2 comments

PROBLEM

======== Resolving module 'easy-table' from '/opt/..../lib/modules/Commands/all/git-yaml/myaction.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module 'easy-table' from 'node_modules' folder, target file type 'TypeScript'.
Directory '/opt/..../lib/modules/Commands/all/git-yaml/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/modules/Commands/all/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/modules/Commands/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/modules/node_modules' does not exist, skipping all lookups in it.
Directory '/opt/..../lib/node_modules' does not exist, skipping all lookups in it.
File '/opt/..../node_modules/easy-table.ts' does not exist.
File '/opt/..../node_modules/easy-table.tsx' does not exist.
File '/opt/..../node_modules/easy-table.d.ts' does not exist.
Found 'package.json' at '/opt/..../node_modules/easy-table/package.json'.
'package.json' does not have a 'types' or 'main' field.

SOLUTION

please change

// package.json

from
"main": ./lib/table

to
"main": ./lib/table.js

We can do this for sure, but the problem is really with build tool you are using. Omitting .js extension in the main field is/was a standard node practice. It should be better to fix the build tool and make it compatible with perhaps many other modules. I suggest to report issue there.

Changed package.main to ./table.js in a new version