Skip to content

Missing "import" key in package.json exports for ESM compatibility #38

Closed
@Vorathe

Description

@Vorathe

Describe the bug
Upgraded to 1.0.12 from 1.0.9 and after running eslint with this update, I see the following error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /node_modules/@smarttools/eslint-plugin-rxjs/package.json imported from /eslint.config.mjs

Repro
Version of @smarttools/eslint-plugin-rxjs you are using: 1.0.12

  1. Create a ESM compatible eslint config
  2. Import '@smarttools/eslint-plugin-rxjs' and add it to plugins and add recommended rules
  3. Run eslint against any file
  4. See error above

Repository that has a reproduction of the problem: Private

Additional context
Downgrading to @smarttools/[email protected] resolves the issue for my project.

Adding "import": "./index.cjs", to the exports in package.json#33 fixes the issue in 1.0.12 for ESM based configs:

"exports": { ".": { "require": "./index.cjs", "import": "./index.cjs", "types": "./index.d.ts" } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions