Skip to content

Upgrading @pkgr/core from 0.2.1 → 0.2.2 causes ERR_REQUIRE_CYCLE_MODULE error #391

@terrymun

Description

@terrymun

When attempting to refresh the pnpm-lock.yaml file on a monorepo, I started running into failures coming from @pkgr/core as it is a dependency of several plugins, in my case eslint-plugin-jsonc and eslint-plugin-mdx.

The exact error I get is:

eslint.config.mjs: Error [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module [REDACTED_ROOT]/node_modules/@pkgr/core/lib/index.js in a cycle. (from [REDACTED_ROOT]/node_modules/eslint-plugin-jsonc/node_modules/synckit/lib/index.cjs)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:346:15)
at loadESMFromCJS (node:internal/modules/cjs/loader:1385:24)
at Module._compile (node:internal/modules/cjs/loader:1536:5)
at Object..js (node:internal/modules/cjs/loader:1706:10)
at Module.load (node:internal/modules/cjs/loader:1289:32)
at Function._load (node:internal/modules/cjs/loader:1108:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
at Module.require (node:internal/modules/cjs/loader:1311:12)
at require (node:internal/modules/helpers:136:16)

Before, works:

devDependencies:
eslint-plugin-jsonc 2.20.0
└─┬ synckit 0.10.3
  └── @pkgr/core 0.2.1
eslint-plugin-mdx 3.4.0
├─┬ eslint-mdx 3.4.0
│ └─┬ synckit 0.11.2
│   └── @pkgr/core 0.2.1
└─┬ synckit 0.11.2
  └── @pkgr/core 0.2.1

After, triggers ERR_REQUIRE_CYCLE_MODULE:

devDependencies:
eslint-plugin-jsonc 2.20.0
└─┬ synckit 0.10.3
  └── @pkgr/core 0.2.2
eslint-plugin-mdx 3.4.0
├─┬ eslint-mdx 3.4.0
│ └─┬ synckit 0.11.3
│   └── @pkgr/core 0.2.2
└─┬ synckit 0.11.3
  └── @pkgr/core 0.2.2

Looking at the changelog between 0.2.1..0.2.2, I suspect it might be due to the introduction of module-sync: e392649#diff-0b810c38f3c138a3d5e44854edefd5eb966617ca84e62f06511f60acc40546c7R23-R26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions