Skip to content

[Bug]: eslint-plugin-react-components build fails — API Extractor cannot resolve package.json import in declarations #35865

@robertpenner

Description

@robertpenner

Component

Other...

Package version

9.73.3

React version

N/A (not a React component)

Environment

System:
    OS: Linux 6.8 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (16) x64 AMD EPYC 7763 64-Core Processor
    Memory: 57.56 GB / 62.80 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  npmPackages:
    @fluentui/react-icons: ^2.0.306 => 2.0.311 
    @fluentui/react-icons-northstar: 0.66.5 => 0.66.5 
    @fluentui/react-northstar: 0.66.5 => 0.66.5 
    @types/react: 19.2.2 => 19.2.2 
    @types/react-dom: 19.2.2 => 19.2.2 
    react: 19.2.0 => 19.2.0 
    react-dom: 19.2.0 => 19.2.0

Current Behavior

nx build eslint-plugin-react-components fails with 2 API Extractor errors:

  • TS2307: Cannot find module '../package.json' or its corresponding type declarations
  • TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type

This also breaks any downstream package that depends on it (e.g. nx build react-motion).

The ES import import { name, version } from '../package.json' in src/index.ts leaks into the generated .d.ts file. API Extractor cannot resolve ../package.json from the output directory (dist/out-tsc/types/...), and the computed property [name] in the exported configs type becomes invalid.

Introduced in commit 835625e — feat(eslint-plugin): propagate enforce-use-client workspace rule to public config (#35504).

Expected Behavior

nx build eslint-plugin-react-components should complete successfully without API Extractor errors.

Reproduction

N/A - this is a build tool error

Steps to reproduce

  1. In the Fluent repo, run
    nx build eslint-plugin-react-components

Are you reporting an Accessibility issue?

None

Suggested severity

Medium - Has workaround

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions