esm-cjs-interop

Analyze ESM/CJS import patterns and circular dependencies in a monorepo.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/orient-bot/orient --skill esm-cjs-interop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: esm-cjs-interop
Source: https://github.com/orient-bot/orient/tree/main/.claude/skills/esm-cjs-interop
Command: npx skills add https://github.com/orient-bot/orient --skill esm-cjs-interop

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common issues arising from the interaction between ECMAScript Modules (ESM) and CommonJS (CJS) module systems within the Orient monorepo, preventing import errors and ensuring smooth module resolution.

Core Features & Use Cases

  • Diagnose Import Errors: Pinpoint and resolve "does not provide an export named" errors.
  • Prevent Circular Dependencies: Identify and refactor code to avoid dependency loops.
  • Guidance on Module Patterns: Provides best practices for ESM/CJS interoperability, including correct import syntax and re-export strategies.
  • Use Case: When your TypeScript build fails with cryptic ESM errors or runtime issues related to module loading, this Skill offers the tools and strategies to fix them.

Quick Start

Run the command grep '"type"' packages/*/package.json to check the module type of each package.

Frequently Asked Questions about esm-cjs-interop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix the "does not provide an export named" ESM error in a TypeScript monorepo?

Resolve the ESM import error by enforcing explicit `.js` extensions in your TypeScript files and using default import patterns for CJS modules. This ensures correct ESM/CJS interoperability and successful module resolution in the monorepo.

Why does my monorepo build fail with "cannot access before initialization" during module loading?

The "cannot access before initialization" error typically indicates circular dependency chains in your monorepo. You need to analyze import patterns and refactor the code to enforce a strict package dependency hierarchy, breaking the dependency loops.

What is the correct import syntax for CommonJS modules in an ESM TypeScript project?

The correct ESM/CJS interop syntax involves using default import patterns for CommonJS modules and enforcing explicit `.js` file extensions in your import paths. This prevents module resolution failures and ensures smooth interoperability.

How do I check the module type of packages in a monorepo to diagnose import conflicts?

Run `grep '"type"' packages/*/package.json` to check the module type of each package. Identifying whether packages are set to ESM or CJS is the first step to diagnosing and resolving interoperability issues and import conflicts.

When do I need to refactor re-export strategies for ESM and CJS interoperability?

You need to refactor re-export strategies when your monorepo experiences module resolution failures or circular dependency chains between ESM and CJS packages. Applying correct re-export patterns ensures explicit dependency hierarchy and prevents runtime errors.