示例工程 14-module-resolution-import-maps

14-module-resolution-import-maps/03-circular-esm-cjs/cycle-fixed-a.js

javascript · 0.2 KB

运行:14 · ESM 循环依赖 TDZ

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

// cycle-fixed-a.js —— 不在求值阶段读取 b,只在函数里访问
import { bValue } from './cycle-fixed-b.js';
 
export const aValue = 'a';
 
export function getA() {
  return aValue;
}
 
export function getB() {
  return bValue;
}