I notice every other library in my node_modules has "main": "index.js" or similar, and import correctly in my project here.
Maybe you could have that file be a no-op in your published packages, and have "main": "index.js" pointing to that no-op, and "typings": "./lib/index.d.ts" instead, so that imports of 'json-schema-to-ts' don't start throwing errors like:
import { JSONSchema6Definition } from "json-schema";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (./dist/src/myfile.js:21:29)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
There may be a better way here, I'm not the leading expert on JS module resolution.
I notice every other library in my node_modules has
"main": "index.js"
or similar, and import correctly in my project here.Maybe you could have that file be a no-op in your published packages, and have
"main": "index.js"
pointing to that no-op, and"typings": "./lib/index.d.ts"
instead, so that imports of 'json-schema-to-ts' don't start throwing errors like:There may be a better way here, I'm not the leading expert on JS module resolution.