syavorsky / comment-parser

Generic JSDoc-like comment parser.
MIT License
239 stars 24 forks source link

npm package tarball does not have valid es6 imports #159

Open mostlylikeable opened 2 years ago

mostlylikeable commented 2 years ago

I installed version 1.3.1 and was unable to import and use it. It seems that the imports in the es6 source in the dist do not end with .js. I forked the repo and packed myself, and the imports were correct in the tarball that was generated on my machien.

Attached is the tarball obtained from npm. comment-parser-1.3.1.tgz

If you unpack it, you'll see that the imports in the *.d.ts files for es6 are like:

import { Options as ParserOptions } from './parser/index';

When it seems they should be like:

import { Options as ParserOptions } from './parser/index.js';

Received this error (and many more) when attempting to build my code:

node_modules/comment-parser/es6/index.d.ts:1:42 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './parser/index.js'?

1 import { Options as ParserOptions } from './parser/index';
Versions
node: 18.12.0
npm:   8.19.2
mostlylikeable commented 2 years ago

fwiw: a workaround is to make sure "skipLibCheck": true is set. I also threw a pr out there to bump ts and use node16 module[Resolution] if that's desired.