[Bug Report]: Cannot access '{default export}' before initialization

Open
#2,426 0 comments 0 reactions 0 assignees View on GitHub

@dvd233 is already working on this.

Since Oct 12, 2026.

  • #2427 by @dvd233 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active

Research direction

Read the reported import chain from LogicFlow.js through model/index.js, LineEdgeModel.js, BaseEdgeModel.js, and util/edge.js; reproduce the error with LogicFlow 2.2.5 in Next.js 16.4.0 using Turbopack. Trace the circular ESM imports that trigger the temporal dead zone and check whether the same entry point works under CommonJS. Done means imports from logicflow/core no longer raise the reported initialization error.

Written by the indexing model from the issue text.

Description

发生了什么?

logicflow/core 2.2.0 和 2.2.5 中可能存在 TDZ 问题。

在 Next.js 16.4.0 (Turbopack) 中,任何来自 logicflow/core 的导入都会报错:

Runtime ReferenceError: Cannot access '{default export}' before initialization

导致 TDZ 的循环链可能在:

LogicFlow.js
  → model/index.js
    → model/edge/index.js
      → LineEdgeModel.js
        → BaseEdgeModel.js
          → util/index.js
            → util/edge.js
              → model/index.js

其中 model/index.js 依赖 LineEdgeModel.js,但是 LineEdgeModel.js 又依赖 model/index.js,形成 TDZ,不过这是 ESM 里特有的问题,在 CJS 中不存在。

logicflow/core版本

2.2.5

logicflow/extension版本

null

logicflow/engine版本

null

浏览器&环境

Chrome, NodeJS

Dominant language
TypeScript
Stars
11.8k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from didi/LogicFlow

All issues in didi/LogicFlow

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.