Skip to content

Undeclared-import scan misses compiled CommonJS and module.exports requires #881

Open

Description

@danfry1

The scan that finds an undeclared workspace library a React Native workspace package imports (#705) counts require("x") only as a whole statement, a declaration's initialiser, or under a member access. Common top-level, unconditional forms are missed:

  • module.exports = require("@w/lib") and exports.x = require("@w/lib");
  • compiled CommonJS: __importDefault(require("@w/lib")) (tsc) and _interopRequireDefault(require("@w/lib")) (Babel);
  • TypeScript's import x = require("@w/lib").

A workspace package whose only runtime entry is built CommonJS therefore still loads the library twice. The ownership guard reports it as SOURCE_EVALUATED_TWICE, but the closure does not take it in.

Acceptance criteria

  • Each form above adds the library to the closure, with a test per form.
  • A require that is conditional, in a string or comment, or type-only is still not counted.

Activity

  1. added this to the 0.16.0 milestone on Nov 15, 2026
  2. added
    bug
    area:ownership
    priority:low
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ownershipbugpriority:low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions