Skip to content

Unable to resolve packages with a duplicate key in package.json #1316

Open
@simon-paris

Description

@simon-paris

A package.json containing a duplicate key works in TS 5 and in other tools. But in TS-go, it causes the package to be unable to be resolved, as if the package.json file didn't exist.

I found this in the wild in several private packages.

To reproduce, the package also needs a non-default "main" property.

Example:

import IORedis from "ioredis";

To force the bug, insert a duplicate property.

{
  "name": "ioredis",
  "name": "ioredis",
src/services/redis-client.ts:1:21 - error TS2307: Cannot find module 'ioredis' or its corresponding type declarations.

1 import IORedis from 'ioredis';

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Module ResolutionRelated to module resolution and module checker errors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions