ReferenceError:初始化前无法访问。这是循环依赖吗?

Old*_*zer 7 node.js es6-modules

在 中index.js,我有:

console.log("index.js loading...");
import express from "express";
export const app = express();

import { router as login } from "./login.js";
app.use("/login", login); 
Run Code Online (Sandbox Code Playgroud)

login.js我有:

console.log("login.js loading...");
import express from "express";
import { app } from "./index.js";
import passport from "passport";

app.use(passport.initialize());
Run Code Online (Sandbox Code Playgroud)

当尝试运行时,我ReferenceError: Cannot access 'app' before initialization在 中的最后一个语句中得到了一个login.js。打印“login.js loading...”行,但不打印“index.js loading...”。

当这两个文件相互导入时,app在 的第三行中是否未完全初始化index.js?加载顺序是如何确定的?index.js如果先加载会出现错误吗?