Skip to content

[Bug] (Linter) : Support of .mjs library dependency #3738

@kpanot

Description

@kpanot

Package name

eslint-plugin, eslint-config

Package version

13.3.0

Reproduction steps

Associated to the comment: #3711 (comment)

  • Create a module type package developed in .mts format in a monorepo (ex: @o3r/my-example).
  • Exposed the generated .mjs files via package.json's main and exports fields.
  • Refer to the entrypoint file in a tsconfig.json's paths mapping
  • Import the package in a second module type package .mts file (ex: import * from '@o3r/my-example';)

Current result

The EsLint import/no-unresolved rule raises an error.

Expected result

Correctly resolve the dependency

Additional comments

Unsatisfying workarounds:

  • Disable the rule at import instruction:
// eslint-disable-next-line import/no-unresolved -- Cannot resolve mjs file in current setup`
  • import the inner package mjs file instead of rely on package.json (or tsconfig paths) links:
from '@o3r/my-example';

will become

from '@o3r/my-example/src/public_api.mjs';

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions