Skip to content

npm package tarball does not have valid es6 imports #159

@mostlylikeable

Description

@mostlylikeable

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions